Let me state my Goal, since I find this is the best way to tell you my problem, and provide you the information to solve it. I know it is a bug, the D5 version works, but as I upgrade to D6, this issue started.
I am attempting to set the width of the image to 100px. Then I want to crop the height to 500px. Most images will not have a 1:5 ratio, so the crop will rarely occur.
In D5 and D6 the setup is
Scale: Width: 100, Height: blank Allow Upscale: none <-- will scall the image too 100px, and should ignore the height (this is correct)
Crop: Width: blank, Height: 500, center, center <--will crop the image to 500px even if the height is not 500. (this is incorrect).
The combination of these will create a black area. Above and bellow the image.
I will assume the logic for crop is not checking the height and/or width before it crops. I will use sudo code for the logic: if (height > crop_height and crop height is not null) then crop the height, if (width >crop_height and crop_height is not null) then crop the width
Comments
Comment #1
drewish commentedbetter title?
i started thinking about the user pictures on myspace and it helped me visualize the problem you're trying to solve. when people upload photos there they're scaled to a width to they fit in a table. people realized that they height isn't constrained so they started uploading skyscraper ratio images. and you're trying to prevent those from going too crazy.
Comment #2
MGParisi commentedYes!
Comment #3
anfrage commentedworkaround until solution is included for:
Crop with only one dimension should use current dimension for missing value
put 100% into the field that you don't want to be changed. in your example:
Crop: Width: blank -> Crop: Width: 100%
than the picture isn't enlarged using black for this direction.
the problem was described here within 6.x-2.0-dev but still exists in 6.x-2.0-beta10. it would be nice if blank fields would be worked on as mentioned.
one quick solution before could be to put this workaround into the description within the page "imagecache_crop for preset .."
Comment #4
fizk commentedPlease reopn if this is still an issue with ImageCache 6.x-2.0-rc1.