• Resolved WPAgentur

    (@wordpressagentur)


    Hello TranslatePress-Team, first thanks for your great work <3

    I found out that my server has thousands of images, with the size of 18×10 and 16×12 pixels, generate automatic by TranslatePress default-settings with no sense, because nobody need a post-image or user-image as flag i any case. Why your plugin do that?

    I found 2 topics here with code for the functions.php but new block-themes has no functions.php so i installed the Code Snippets plugin and paste the code as new php-function but since then nothing change and TranslatePress still generate 18×10 and 16×12 pixel images of EVERY new post.

    Here is the code:
    function wpdocs_remove_plugin_image_sizes() {
    remove_image_size( ‘trp-custom-language-flag’);
    }
    add_action(‘init’, ‘wpdocs_remove_plugin_image_sizes’);


    Would it be possible to build in a new option like “Stop generating images from normal posts” so additional flags (i think that’s a really rare case because all standard flags are shipped onboard by default) will still work but normal posts and there images will not affected?

    A second way would be, to insert a image-upload for additional flags ONLY at page=trp_advanced_page#custom_language , that would be the much easier way that not affect the post-generation or media library at all.

    Additional cleaning-option would be nice too:
    Checkbox -> Search for falsely generate flags and delete them

    For others with the same problem and bloated server-space: Right now i have to use WPCLI and the following commands. Find and delete them:
    find . -name *-18x10.* | xargs rm -f
    find . -name *-16x12.* | xargs rm -f


    I think that suggestion could save 300,000+ users, millions of megabytes at your next update. Hope there will be a way to stop that in future <3

    • This topic was modified 1 year ago by WPAgentur.
Viewing 1 replies (of 1 total)
  • Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    We will stick to the existing way of just adding the image size all the time.
    There is no real concern about performance because the image size we register is really small so it doesn’t occupy a lot of space on servers.
    The additional image size will be used in srcset for all images (non-TP too) but that does not increase the site’s page loading time.
    However, you can achieve the restriction through a custom code:
    1. Create an empty plugin like this: https://gist.github.com/sareiodata/76f701e01db6685829db

    2. Add the following code to the end of it:
    add_action('after_setup_theme', 'trpc_remove_trp_image_size');
    function trpc_remove_trp_image_size(){
    remove_image_size( 'trp-custom-language-flag' );

    3. Install this plugin via FTP (copy it inside wp-content/plugins) or create a zip archive with it and install it via the WordPress plugin upload functionality

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin generates imagesizes 18×10 and 16×12 of ALL images and bloat the server’ is closed to new replies.