-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't create duplicate image sizes #324
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ocean90 Thanks for the fix! Could you take a look at why the PHPUnit and Cypress tests started failing? Also, I’ve added a couple of minor suggestions below.
Co-authored-by: Faisal Alvi <[email protected]>
$resized = $editor->resize( $size, $size, true ); | ||
if ( ! is_wp_error( $resized ) ) { | ||
$dest_file = $editor->generate_filename(); | ||
$saved = $editor->save( $dest_file ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this isn't new code, but do you think we should account for the case where generate_filename()
returns false
?
Description of the Change
Check size of original image before creating a duplicate version of it.
Closes #323
How to test the Change
Upload an image of an avatar size that is used on the site. Ensure that no version is created for this size.
Changelog Entry
Credits
Props @ocean90
Checklist: