[wp-trac] [WordPress Trac] #44095: wp_generate_attachment_metadata() can overwrite previously uploaded images with the intermediate sized images it creates
WordPress Trac
noreply at wordpress.org
Tue May 15 18:46:22 UTC 2018
#44095: wp_generate_attachment_metadata() can overwrite previously uploaded images
with the intermediate sized images it creates
--------------------------+------------------------------
Reporter: pbiron | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------+------------------------------
Changes (by pbiron):
* keywords: => dev-feedback
Comment:
There are a number of places in the process where the intermediate sized
filenames could be "unique"-ified, e.g.,
* [[https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
wp-image-editor.php#L366|WP_Image_Editor::generate_filename()]]
* [[https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
wp-image-editor.php#L334|WP_Image_Editor::get_output_format()]]
* [[https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
wp-image-editor-gd.php#L243|WP_Image_Editor_GD::multi_resize()]] (and the
equivalent in [[https://core.trac.wordpress.org/browser/trunk/src/wp-
includes/class-wp-image-editor-
imagick.php#L461|WP_Image_Editor_Imagick::multi_resize()]]).
I'm fairly unfamiliar with that part of the core code so I'm not really
sure which of those place (and maybe others that I've discovered) would be
the safest/most reliable for core's needs.
However, I will note that 2 **very widely used** plugins
([[https://wordpress.org/plugins/regenerate-thumbnails/|Regenerate
Thumbnails]] and
[[https://wordpress.org/plugins/woocommerce/|WooCommerce]]) make calls to
`WP_Image_Editor::generate_filename()` but not
`WP_Image_Editor_{GD|Imagick}::multi_resize()`when they resize images.
So, I'm **very** interested in the opinion of those who are familiar with
both the relevant parts of the core code and how other plugins would deal
with any change.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44095#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list