syamilmj / Aqua-Resizer

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

Test for images fitting the required measures is wrong. #46

Closed eaceaser closed 10 years ago

eaceaser commented 10 years ago

Images that are passed in with the exact measurements for resizing end up returning false as opposed to returning the original image:

Line 102:

if ( ! $dims && ( ( ( null === $height && $orig_w == $width ) xor ( null === $width && $orig_h == $height ) ) xor ( $height == $orig_h && $width == $orig_w ) ) ) {

Should be:

if ( ! $dims || ( ( ( null === $height && $orig_w == $width ) xor ( null === $width && $orig_h == $height ) ) xor ( $height == $orig_h && $width == $orig_w ) ) ) {
mxmzb commented 10 years ago

It's intended behavior. Why would you want to work through an image to just create an exact duplicate? If it's the same, the script does so by telling you so and it's up to you to detect why it's returning false, so you can use the original image still. It may seem odd, but imho it's sustaining a good amount of flexibility (vs. less flexibility but more automatic).