• Hi.
    Thanks for so great plugin!

    I have a strange and very annoying issue. I hope you could help with it.

    After some plugin manipulations, all SVG files were removed at all. It is not the first time, so, I start to look at a solution.

    PHP 7.2.16, WordPress 5.4.1, Advanced Custom Fields PRO 5.8.9, SVG Support 2.3.18 & Regenerate Thumbnails 3.1.3.

    I’m not sure the exact the issue context but I reproduced the issue when:
    1) add_image_size(‘test’, 666, 0);
    2) regenerate thumbnails with different settings (all was Ok);
    3) remove the ‘test’ size in PHP;
    4) process the thumbnails regeneration with next options:
    [ ] 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.

    Screenshots:
    https://www.screencast.com/t/A7mZiVIwJD – SVGs in the Media after the issue has happened; attachments are, but no files in the server;
    https://www.screencast.com/t/kdc55Buu – an “empty” SVG attachment;
    https://www.screencast.com/t/ddoTQoAdrO – if I’ll recovery SVG files directly by SFTP all is good;
    During work (in this time SVGs were deleted) I had only these plugin’s messages:
    a) https://www.screencast.com/t/lbKhwFxcjfzR (“Skip”);
    b) https://www.screencast.com/t/FxkAGn9sA5 (“The fullsize image file cannot be found in your uploads directory at %s. Without it, new thumbnail images can’t be generated.”).

    I think I don’t process SVG with custom theme code.

    Perhaps it is related that SVG doesn’t have ‘sizes’ and the ‘old size’ === the ‘original image’ or something similar? wp_delete_file( $wp_upload_dir . $old_size_data['file'] );

    Thanks in advance for your time.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Unfortunately, WP 5.3, and above, is removing all $image_meta[sizes] on regenerate.

    I guess, SVG media should never be regenerated. At least because there is nothing to be regenerated.

    1) AFAIK, there is no class-editor that supports SVG
    2) SVG is supposed to be “all-sizes-fit”
    3) No sizes needed for SVG.

    Thread Starter Kostiantyn Petlia

    (@artfulcat)

    The question is still there. Why and how were removed original SVG files if they should be skipped in any case (regenerating thumbs, deleting old sizes, any other)? I have to understand and find the reason because it is important for site integrity.

    Are the SVGs in your media library or do they exist somewhere else on the site? I tested with some SVGs in my media library and it said:

    Skipped Attachment ID 460 (test svg): The current image editor cannot process this file type.

    I can confirm the same thing happened for us on several sites. This only seems to occur when ‘delete unregistered thumbnails’ is selected, and it removes the svg files from the server even though they still show in the media library (with no thumbnail). The original file URL path throws a 404 error and the files are no longer in the folder when checking via FTP.

    I think the issue is that the .svg files aren’t recognized as a ‘required’ thumbnail size, and hence being deleted rather than ignored (which is what should be happening with SVG media).

    Thread Starter Kostiantyn Petlia

    (@artfulcat)

    Yep.

    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…

    Hi.

    Faced the same problem. Removed all SVG after full regeneration.

    I also think that deleting content is a critical bug. We lost 40% of the images from the home page.

    I am experiencing the same symptoms…with the Delete Thumbnail Files… option on, regenerating deletes the SVG files (but leaves the metadata). I’m using plugin “SVG support” to, um, provide SVG support.

    Any word on when we might expect a fix?

    Noting here that this is still a major issue and caused a client to open up a ticket after thumbnail issues were fixed on other images and the Delete Unused option was chosen. I haven’t looked at the plugin code to confirm if there is a hook available to skip SVGs, but this needs to be fixed.

    Plugin Author Donna Peplinskie (a11n)

    (@donnapep)

    Apologies on the delay with this. I agree that this is a fairly serious issue.

    I’ve made a simple three line change that seems to fix the issue, although it still needs to go through a code review before a new version of the plugin can be released. With luck, that will be soon.

    If you like you can apply this change to your local copy of the plugin in the meantime, although you would do so at your own risk.

    Cheers.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘All SVG files were removed after plugin work’ is closed to new replies.