Developer forum

Forum » Development » DW GetImage.ashx Crop question

DW GetImage.ashx Crop question

Dmitrij Jazel
Reply

Hei Everyone,

Wanted to ask, how should I approach the problem.

We have a webshop, with images, All of them are of different proportions all the time.

 

When I am using GetImage.ashx if I will request to generate image, if I want a thumbnail, than it will also crop - but as a result you will get an "cut image".

What If I would like it to crop Outside?

Or if you request image size that bigger than actual image itself, it will just return same image, and will not "fill in the blanks" so to speak, in order to meet the size of image I requested.

 

Any suggestions how to avoid this, and make sure that it fills the whole space as solid image by not streching or squeezing the image like it does with  Crop=6 ?

 

/Dmitrij


Replies

 
Nicolai Høeg Pedersen
Reply

When you specify a width and a height, the image will be cropped to that exact size or resized to fit inside that rectangle - depending on your settings.

DW cannot pad the image.

An alterntive is to set only a height or a width and let the other side be calculated.

If you have an image area of say 200*300 px, create a div around the image with that exact size, set width=200&height=300&crop=5 and center the image directly in the middle of that div using css. You can also set the image as a background on the div and use background-size:cover in css (it will crop the image in one or the other side if aspect ratio does not fit, but will resize with the browser).

Nicolai

 
Dmitrij Jazel
Reply

Hi Nicolai,

Thanks for reply, and well... that is what I was afraid of.

Would be great if it could somehow. With a possibility to define a custom hex code for the area that was padded. Would gladly make it as a feature request.

I thought about the trick that you said, obviously there is some css workarround here, but when you include other 3rd party plugins, and other obsticles, this does not make our day easyer...

Aniways, thanks for reply. I will try to see what I can do.

 

/Dmitrij

 

You must be logged in to post in the forum