So... after some tinkering I discovered a few things.
1. transform_command returns an array.
2. the resize is ahead of crop in the array, which means that the image is being resized, then cropped, which obviously won't work.
This very simple hack fixed the expected functionality:
ruby
deftransformation_commandif crop_command
arr = super
p "un modded #{arr}"
arr[3] = crop_command
p "modded #{arr}"
[arr[2],arr[3],arr[0],arr[1],arr[4]]
elsesuperendenddefcrop_command
target = @attachment.instance
if target.cropping?
"\"#{target.crop_w}x#{target.crop_h}+#{target.crop_x}+#{target.crop_y}\""endend
The array varies depending on the transform, so this is indeed an unreliable HACK.
I'd fix it, but I think I'll explore a CarrierWave solution instead.
So... after some tinkering I discovered a few things.
1. transform_command returns an array.
2. the resize is ahead of crop in the array, which means that the image is being resized, then cropped, which obviously won't work.
This very simple hack fixed the expected functionality:
The array varies depending on the transform, so this is indeed an unreliable HACK.
I'd fix it, but I think I'll explore a CarrierWave solution instead.