wp-manual-image-crop icon indicating copy to clipboard operation
wp-manual-image-crop copied to clipboard

Check for whether to make a Retina crop always fails

Open acobster opened this issue 7 years ago • 0 comments

When the ManualImageCrop class checks whether it should create a Retina crop for the current image, the check will always return false. This is because the make2x data value is initialized as a boolean in filterPostData():

$data['make2x'] = filter_var($_POST['make2x'], FILTER_VALIDATE_BOOLEAN);

...but when cropImage() checks this value, it uses the strict comparison operator against a string:

// Generate Retina Image
if( isset( $data['make2x'] ) && $data['make2x'] === 'true' ) {
    ...
}

The code should instead check against literal true (or, since it represents a checkbox, assume any truthy value means "yes").

I will make a PR for this soon. :)

acobster avatar Mar 09 '17 21:03 acobster