But if the image is smaller than the size(s) specified, can we make it just pad out the remaining space? So, if an image is less than 2000px wide then display as-is, otherwise crop to 2000px.
If you want your output image to be 2000px wide, no matter how wide (or narrow) the image is, then mode=pad should do this and the image will always be 2000px wide (or always 400px tall) but with a padding added.
Trouble is that this keeps the original image's aspect ratio so if you have a 800w 800h image and use the options above with 200w 300h then you will have 50 pixels padding top and bottom instead of just cropping down the image.
What needs to happen is that the image needs to be "no more than" 2000 x 400. So, if it is only 1190 x 360 then the resultant image will be 1190 x 360.
If the image is bigger then it will be cropped.
We are trying the upScale = false option at the moment, that may work the required way.
Can Image Cropper Pad?
We are using the following to ensure images are not bigger than we want:
But if the image is smaller than the size(s) specified, can we make it just pad out the remaining space? So, if an image is less than 2000px wide then display as-is, otherwise crop to 2000px.
Hi Gordon,
It does pad but not sure it does what you want.
Here are the list of options from the Image Processor site; http://imageprocessor.org/imageprocessor/imagefactory/resize/#example
If you want your output image to be 2000px wide, no matter how wide (or narrow) the image is, then mode=pad should do this and the image will always be 2000px wide (or always 400px tall) but with a padding added.
Trouble is that this keeps the original image's aspect ratio so if you have a 800w 800h image and use the options above with 200w 300h then you will have 50 pixels padding top and bottom instead of just cropping down the image.
Not sure if this will help!
Cheers
What needs to happen is that the image needs to be "no more than" 2000 x 400. So, if it is only 1190 x 360 then the resultant image will be 1190 x 360.
If the image is bigger then it will be cropped.
We are trying the upScale = false option at the moment, that may work the required way.
Can't you just have a look at the width and height of the image, as stored by Umbraco, and make a call based on that?
You can always look at the crops if necessary too:
Are you using GetCropUrl?
You can pass in a CropMode parameter such as this to make ImageProcessor Pad rather than Crop:
Yeh. What Jeavon said. That's much neater.
You could use the 'boxpad' function vs 'pad' - that won't stretch your image but pad it out to the required size
is working on a reply...