id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses 44095,wp_generate_attachment_metadata() can overwrite previously uploaded images with the intermediate sized images it creates,pbiron,,"When [[https://developer.wordpress.org/reference/functions/wp_generate_attachment_metadata/|wp_generate_attachment_metadata()]] creates/saves intermediate sized images, it can sometimes overwrite an original image from a previous upload. Steps to reproduce: 1. set thumbnail size to 150x150 1. create a 300x300 image named `foo-150x150.jpg` 1. upload `foo-150x150.jpg` 1. create another 300x300 image named `foo.jpg` 1. upload `foo.jpg` If you then check the appropriate dir in `/wp-content/uploads` you will see that the original `foo-150x150.jpg` has been overwritten by the `thumbnail`-sized version of `foo.jpg`. Original filenames containing `-{width}x{height}` suffixes can be quite common, especially on artwork-related sites. A real-world example of the ""steps to reproduce"" above is as follows: 1. a painter does an oil painting of a sunset on a 150cmx150cm canvas and uploads a photo of that artwork named `sunset-150x150.jpg` (where, in their mind, the `-150x150` suffix is the canvas size of their painting) 1. a photographer then uploads their photograph of a sunset named `sunset.jpg` ...and the photographer has just overwritten the painter's original image :-( ",defect (bug),closed,normal,,Media,5.1,normal,duplicate,dev-feedback,,