#62388 closed defect (bug) (duplicate)
If image size exists with crop and without crop, only 1 will be created,
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
Essentially https://core.trac.wordpress.org/ticket/61925 but if the same size exists with crop true and crop false, then whatever size was added later will overwrite a previous one, since the resulting file names are identical.
e.g. foo-450x450.png would be created first uncropped, then cropped resulting in only the cropped file being available.
So while the other ticket is purely an efficiency one, this is a bug since it's unexpected that the order in which the sizes are added matters and you could end up with cropped images when you added an uncropped size or vice versa
Change History (3)
#2
@
5 months ago
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #61925.
Turns out WP is not cropping at all in the first place, but crop refers to enforcing either one or both provided dimensions https://core.trac.wordpress.org/ticket/62389#ticket
So this is a duplicate of the referenced issue then, but something one has to be aware of, since we can also skip the crop if the dimensions would scale/scaled dimensions match the crop requested dimensions
@abcd95 thanks for your reply. Next time check the issue at hand first, because your comment is not helpful or adding anything to the conversation.
Hi, Thanks for bringing this up.
I propose a solution, The fix adds a
-cropped
suffix to cropped image filenames in thegenerate_filename()
method of theWP_Image_Editor
class. This ensures unique filenames for cropped and uncropped versions.Please let me know if we can do better.
Thanks.