syamilmj / Aqua-Resizer

Resize WordPress images on the fly
502 stars 208 forks source link

Smaller images than specified don't show? #40

Closed justiny closed 10 years ago

justiny commented 10 years ago

I've run into an issue, or at least an issue that I've noticed, that if a user uploads an image smaller than the image crop is specified, the image doesn't show at all. For example if I have set 250px x 250px to show in a gallery, and a user tries to display an image that is 200px x 200px, then the image doesn't show.

Is this an issue or is it something I'm doing wrong?

Thanks! Justin

mxmzb commented 10 years ago

This is intended behavior by the script. You can force to upscaling images by providing the $upscale argument to the function.

justiny commented 10 years ago

Can you offer an example of how to add that function? Thanks so much :)

mcpmbstu commented 10 years ago

this is the function function aq_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) { $aq_resize = Aq_Resize::getInstance(); return $aq_resize->process( $url, $width, $height, $crop, $single, $upscale ); }

here u can see.......process( $url, $width, $height, $crop, $single, $upscale );

just use this to get image info $image = aq_resize( $img_url, 718, 250, true, true, true ); //resize & crop the image

then

your smaller image now can work.....

hope it will work with you....