Automattic / regenerate-thumbnails

WordPress plugin for regenerating thumbnails of uploaded images. Over 1 million active users and counting.
https://alex.blog/wordpress-plugins/regenerate-thumbnails/
GNU General Public License v2.0
133 stars 54 forks source link

SVGs Deleted from File System when Delete Unregistered Sizes Used #110

Closed timnolte closed 3 years ago

timnolte commented 4 years ago

This issue has been opened and explained/tested her: https://wordpress.org/support/topic/all-svg-files-were-removed-after-plugin-work/

From the Forums:

Here is the reproduce bug way:

1) Add SVG to Uploads in the normal way.

2) Regenerate all thumbnails with unchecked both: [ ] Skip regenerating existing correctly sized thumbnails (faster). [ ] Delete thumbnail files for old unregistered sizes in order to free up server space. This may result in broken images in your posts and pages.

The result will “Skipped unsupported file format”.

https://www.screencast.com/t/5Miqpuis3

3) Add a new image size, for example: add_image_size( 'test-only', 666, 666, ['center', 'center'] );

4) Repeat the step 2 and after it remove the new image size in PHP.

5) Regenerate all thumbnails with: [ ] Skip regenerating existing correctly sized thumbnails (faster). [V] Delete thumbnail files for old unregistered sizes in order to free up server space. This may result in broken images in your posts and pages.

The result will “The full-size image cannot be found in the uploads folder in 2020/04/ logo-visa.svg. Without this image, no new thumbnail images can be generated.”

https://www.screencast.com/t/orxruzqkf

So, here SVG files were gone!

6) We have all SVGs in Media are still present, but broken (without a file).

https://www.screencast.com/t/FaVU4OShRjR

https://www.screencast.com/t/sxhArEeE

Perhaps, the root of the problem is in something other. Let’s find a solution. Guys, do only I think it is a critical bug? Imagine, if the production site has a lot of SVGs and all they will go away…

alexsanford commented 3 years ago

Fixed in #111, to be released in version 3.1.4.