Okay
  Public Ticket #3344394
Images Sizes
Closed

Comments

  •  4
    AETekno started the conversation

    I see that Salient generates 19 different sizes for each of my images. This is generating a huge number of files on my hosting server. To avoid taking up unnecessary server space, I would like to remove the sizes that are not used.

    1) I have seen the documentation how to remove the sizes but they don't seem to correspond to the number of sizes I have.

    2) But my main question is - how can I determine which sizes are not used in my website? If I remove a size, will the next size up or down be chosen or will I have a blank space?

    Thank you in advance for the advice.

  •  2,958
    Andrew replied

    Hello there,

    Thank you for reaching out to us.

    By default, WordPress generates three sizes for every image uploaded. You can find more information about disabling those default sizes here: https://www.wpbeginner.com/wp-tutorials/how-to-prevent-wordpress-from-generating-image-sizes/. You can also view this article to help you clean up your gallery https://wpengine.com/resources/wordpress-media-library-clean-up/.

    Kind regards,

  •  4
    AETekno replied

    Hello Andrew

    Thank you for your reply. I don't mean the 3 sizes generated by WordPress I mean the files generated by Salient. In the ecommerce ultimate demo I installed I count 17 instances of each image. See attachment.

    In the documentation you explain how to remove the image size but they don't correspond to the sizes I have and how do I remove all the unwanted ones once they are created and which are the essential ones?

    Attached files:  Salient-İmage-Sizes.png
      Salient-doc-about-images.png

  •  2,958
    Andrew replied

    Hello again,

    Thank you for getting back to us.

    For the other image sizes generated by the theme, you will need to edit the media.php (/nectar/meta/category-meta.php) file in order to disable the sizes. The best option would be to 'comment out' whatever sizes you don't need.

    In the meantime, you can use any of the plugins suggested here to clean your media gallery  https://wpengine.com/resources/wordpress-media-library-clean-up/.

    I hope that helps.

    Kind regards,

  •  4
    AETekno replied

    Dear Andrew,

    The documentation says to change file functions.php, you tell me to change file /nectar/meta/category-meta.php file but actually I found the image sizes in /nectar/helpers/media.php

    So my main question is out of all these sizes which ones are necessary for the correct functionning of the website?

    if ( ! function_exists( 'nectar_add_image_sizes' ) ) {
        function nectar_add_image_sizes() {
            add_image_size( 'portfolio-thumb_large', 900, 604, true );
            add_image_size( 'portfolio-thumb', 600, 403, true );
            add_image_size( 'portfolio-thumb_small', 400, 269, true );
            add_image_size( 'portfolio-widget', 100, 100, true );
            add_image_size( 'nectar_small_square', 140, 140, true );
            global $nectar_options;
            $masonry_sizing_type = ( ! empty( $nectar_options['portfolio_masonry_grid_sizing'] ) && $nectar_options['portfolio_masonry_grid_sizing'] === 'photography' ) ? 'photography' : 'default';
            if ( $masonry_sizing_type !== 'photography' ) {
                
                add_image_size( 'wide', 1000, 500, true );
                add_image_size( 'wide_small', 670, 335, true );
                add_image_size( 'regular', 500, 500, true );
                add_image_size( 'regular_small', 350, 350, true );
                add_image_size( 'tall', 500, 1000, true );
                add_image_size( 'wide_tall', 1000, 1000, true );
                add_image_size( 'wide_photography', 900, 600, true );
            } else {
                
                // These three are still needed for meta overlaid masonry blog.
                add_image_size( 'regular', 500, 500, true );
                add_image_size( 'regular_small', 350, 350, true );
                add_image_size( 'wide_tall', 1000, 1000, true );
                add_image_size( 'wide_photography', 900, 600, true );
                add_image_size( 'wide_photography_small', 675, 450, true );
                add_image_size( 'regular_photography', 450, 600, true );
                add_image_size( 'regular_photography_small', 350, 467, true );
                add_image_size( 'wide_tall_photography', 900, 1200, true );
            }
            add_image_size( 'large_featured', 1870, 770, true );
            add_image_size( 'medium_featured', 800, 800, true );
    

    Which are needed?

  •  2,958
    Andrew replied

    Hello again,

    To clarify, you'd have to add the code to the functions.php file of your child theme to override the changes in your theme. 

    I can't define which sizes are important to you as this would depend on your preference as all the sizes are used by the theme in different instances depending on your settings.

    I hope that info helps.

    Kind regards,

  •  4
    AETekno replied

    Thank you Andrew

    So basically if I don't use Portfolio I go copy the file nectar/helpers/media.php to my child theme

    I disable the line for the image sizes I don't need

    I add this code??? to my functions.php file in my child theme?? Or something else?? 

    Hoping you can clarify for me, I just need clear explanations to settle the issue please. Thank you

    /**
     * General WordPress.
     */
    require_once NECTAR_THEME_DIRECTORY . '/nectar/helpers/wp-general.php';
    
  •  2,958
    Andrew replied

    Hello again,

    We normally recommend making any changes to the theme in the child theme function.php files.

    You can also refer to this ticket for further clarification https://themenectar.ticksy.com/ticket/2386230/.

    I hope that clarifies this query.

    Kind regards,

  •  4
    AETekno replied

    Thank you Andrew. So basically these 14 extra image sizes are created if you want to use a photography or portfolio grid but unnecessary if you are just using an ecommerce theme. 

    It would be nice to have this as an option in the Portfolio section of the Theme Options for example.

  •  1,877
    Judith replied

    Hi there,

    Sure, we'd love to take this as a suggestion to help us improve on our features for the coming updates.

    Please feel free to contact us in case of any other queries.

    Thanks.