• Resolved Jan

    (@krugmedien)


    Hi,

    i want to change some existing image sizes and use this code:

    function change_image_sizes()
    {
    
      remove_theme_support( 'et-pb-post-main-image-fullwidth' );
      remove_theme_support( 'et-pb-image--responsive--desktop' );
      remove_theme_support( 'et-pb-image--responsive--tablet' );
      remove_theme_support( 'et-pb-image--responsive--phone' );
    
      add_image_size( 'et-pb-post-main-image-fullwidth', 1080, 810, true );
      add_image_size( 'et-pb-image--responsive--desktop', 1280, 960, true );
      add_image_size( 'et-pb-image--responsive--tablet', 980, 735, true );
      add_image_size( 'et-pb-image--responsive--phone', 480, 360, true );
    
    }
    
    add_action( 'after_setup_theme', 'change_image_sizes', 99 );

    Your plugin shows the new sizes, but does not change the old images, see:

    http://web64.s237.goserver.host/image_regenerating_not_working.png

    All other sizes and the old sizes work fine, just the new ones dont. There are no errors in the WordPress debug.log file.

    Do you have an idea why this is happening?

    Thanks,
    Jan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Jan

    (@krugmedien)

    The image sizes are added in this file: /wp-content/themes/Divi/post_thumbnails_divi.php

    <?php
    add_theme_support( 'post-thumbnails' );
    
    global $et_theme_image_sizes;
    
    $et_theme_image_sizes = array(
    	'400x250'  => 'et-pb-post-main-image',
    	'1080x675' => 'et-pb-post-main-image-fullwidth',
    	'400x284'   => 'et-pb-portfolio-image',
    	'510x382'   => 'et-pb-portfolio-module-image',
    	'1080x9999' => 'et-pb-portfolio-image-single',
    	'400x516'   => 'et-pb-gallery-module-image-portrait',
    	'2880x1800' => 'et-pb-post-main-image-fullwidth-large',
    );
    
    $et_theme_image_sizes = apply_filters( 'et_theme_image_sizes', $et_theme_image_sizes );
    $crop = apply_filters( 'et_post_thumbnails_crop', true );
    
    if ( is_array( $et_theme_image_sizes ) ){
    	foreach ( $et_theme_image_sizes as $image_size_dimensions => $image_size_name ){
    		$dimensions = explode( 'x', $image_size_dimensions );
    
    		if ( in_array( $image_size_name, array( 'et-pb-portfolio-image-single' ) ) )
    			$crop = false;
    
    		add_image_size( $image_size_name, $dimensions[0], $dimensions[1], $crop );
    
    		$crop = apply_filters( 'et_post_thumbnails_crop', true );
    	}
    }
    
    if ( function_exists( 'et_screen_sizes' ) && function_exists( 'et_is_responsive_images_enabled' ) && et_is_responsive_images_enabled() ) {
    	// Register responsive image sizes.
    	$et_screen_sizes = et_screen_sizes();
    	if ( $et_screen_sizes && is_array( $et_screen_sizes ) ) {
    		foreach ( $et_screen_sizes as $breakpoint => $width ) {
    			$height = round( ( $width * ( 56.25/100 ) ) ); // 16:9 aspect ratio.
    			add_image_size( "et-pb-image--responsive--{$breakpoint}", $width, $height, $crop );
    		}
    	}
    }
    

    And this file is loaded in the themes functions.php: /wp-content/themes/Divi/functions.php

    function et_setup_theme() {
    	…
    	require_once $template_directory . '/post_thumbnails_divi.php';
    	…
    }
    add_action( 'after_setup_theme', 'et_setup_theme' );

    Hope this helps, I am still trying to find a solution. 🙂

    Plugin Author Jake Morrison (a11n)

    (@jakeom)

    Hi @krugmedien

    Would you mind posting a screenshot after you click the Regenerate Thumbnails (Vorschaubilder regenerieren) button included in your first screenshot? If you expand your browser’s Inspector tool, you can also sometimes see additional errors from the process after you click that button in the Console.

    Once thing to check would be the directory and file permissions for the image to make sure they are writable by your PHP process.

    Best,

    Jake

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Some sizes not working’ is closed to new replies.