• The defauly media gallery uses ‘medium’ by default and if not avail uses full. There should be a setting that we can choose from any registered size. the need for this is, many are movign to optimized image sizes (and webp), and turning off the WP default sizes…. so the Media Gallery will bloat the browser with massive images.

    I have found some code solutions but none are working for me.

Viewing 1 replies (of 1 total)
  • To change the default size of images displayed in the WordPress media gallery, you can add the following code to your theme’s functions.php file:

    function my_gallery_default_type_set_link( $settings ) {
        $settings['galleryDefaults']['link'] = 'file';
        $settings['galleryDefaults']['size'] = 'thumbnail'; //replace 'thumbnail' with your desired image size name
        return $settings;
    }
    add_filter( 'media_view_settings', 'my_gallery_default_type_set_link');
    

    This code sets the default image size for the gallery to ‘thumbnail’, but you can replace ‘thumbnail’ with any registered image size name that you want to use.

    If you have optimized image sizes and webp enabled, you can also create your own custom image size using the add_image_size() function and use that size in the code above. For example:

    function my_custom_image_sizes() {
        add_image_size( 'custom-size', 800, 600 ); //set the desired dimensions for your custom image size
    }
    add_action( 'after_setup_theme', 'my_custom_image_sizes' );
    

    Then, replace ‘thumbnail’ with ‘custom-size’ in the code above to set your custom size as the default for the gallery.

    I hope this helps! Let me know if you have any further questions.

Viewing 1 replies (of 1 total)
  • The topic ‘Media Gallery Image Size Should be Admin Settable’ is closed to new replies.