I am using Image Style with Scale and Crop
option with the dimension 110 * 110
. If the style applies on small image it upscales the size to 110 * 110
. I don't want to upscale it. How to do that?
3 Answers
- A separate scale image effect followed by a separate crop image effect won't give you what you want.
- Imagecache Actions does not offer a single image effect that does what you want.
However, what you could do is use the aspect switcher image effect of imagecache_actions:
aspect switcher:
- if portrait: scale to 110x(empty) (no upscaling)
- if landscape: scale to (empty)x110 (no upscaling)
crop to 110x110
-
It works but it sets black background in images. i dont want black background. Jun 20, 2013 at 5:26
-
I tested it with a smaller image and with a portrait and a landscape image that are larger and it seems to work for me. The larger images are 110x110,the smaller one remains smaller. There is an error in core though, as it sets the dimensions to the specified crop dimensions, also for smaller images. So the width and height attribute of the img tag are incorrect. Jun 20, 2013 at 10:45
-
OK, with GD as toolkit it fails as you describe, with imagemagick it works. Another error in core? Jun 20, 2013 at 10:52
-
ImageCache Actions module gives you way better control. Using it, you can create an "downscale, crop, put on background" set of commands that will give you 110 x 110 px image without upscaling.
With the image style scale and crop
option, it will always upscale the image. It is only with an image style like scale
that you have the options of not up-scaling. So your best option is to find another image style that might meet your need. For more image style options, check out the Imagecache Actions