Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1203092

    Today I discovered that in some archive pages the images are not showing.

    Where can the problem be?

    I have this functions you shared.

    
    // tag and archive as grid
    	add_filter('avf_blog_style','avia_change_tag_blog_layout', 10, 2); 
    	function avia_change_tag_blog_layout($layout, $context){
    		if($context == 'tag') $layout = 'blog-grid';
    		return $layout;
    	}
    
    	add_filter('avf_blog_style','avia_change_category_blog_layout', 10, 2); 
    	function avia_change_category_blog_layout($layout, $context){
    		if($context == 'archive') $layout = 'blog-grid';
    		return $layout;
    	}
    // tag and archive as grid
    
    /**
     * Set sizes atribute for responsive images and better performance
     * @param  array        $attr       markup attributes
     * @param  object       $attachment WP_Post image attachment post
     * @param  string|array $size       named image size or array
     * @return array        markup attributes
     */
    function avf_responsive_img_sizes( $attr, $attachment, $size ) {
        if ( is_array( $size ) ) {
            $attr['sizes'] = $size[0] . 'px';
        } elseif ( $size == 'widget') {
            $attr['sizes'] = '36px';
        } elseif ( $size == 'square') {
            $attr['sizes'] = '180px';
        } elseif ( $size == 'featured') {
            $attr['sizes'] = '1500px';
        } elseif ( $size == 'featured_large') {
            $attr['sizes'] = '1500px';
        } elseif ( $size == 'extra_large' ) {
            $attr['sizes'] = '1500px';
        } elseif ( $size == 'portfolio' ) {
            $attr['sizes'] = '495px';
        } elseif ( $size == 'portfolio_small' ) {
            $attr['sizes'] = '260px';
        } elseif ( $size == 'gallery' ) {
            $attr['sizes'] = '845px';
        } elseif ( $size == 'magazine' ) {
            $attr['sizes'] = '710px';
        } elseif ( $size == 'masonry' ) {
            $attr['sizes'] = '705px';
        } elseif ( $size == 'entry_with_sidebar' ) {
            $attr['sizes'] = '845px';
    	} elseif ( $size == 'entry_without_sidebar' ) {
            $attr['sizes'] = '1210px';
        }
        return $attr;
    }
    add_filter( 'wp_get_attachment_image_attributes', 'avf_responsive_img_sizes', 30, 3 );
    

    Should I remove the ones for images?

    Thanks.

    #1203169

    Hey peterolle,
    Thanks for the links, I notice that it seems your image size 495px has been removed, your images are leading to a 404
    It looks like only your original image and two sizes are posted with each image, but your category pages only use the size that is removed.
    2020-04-12_161814.png

    Best regards,
    Mike

    #1203170

    I didn’t remove images for some posts and others not to have things incorrect. Starting page 3 till the end all images appear fine, so there is something else.

    How can I fix those and regenerate them?

    Thanks.

    #1203193

    Hi,
    Each of those images are using the original full-size image and not the 495 image.
    To regenerate the images you could try this plugin, but I recommend checking that the “portfolio” size is being created, try adding this code to the end of your functions.php file in Appearance > Editor:

     function your_thumbnail_sizes() {
    	global $_wp_additional_image_sizes;
    print '<pre>';
    print_r( $_wp_additional_image_sizes );
    print '</pre>';
    }
    add_shortcode('your-sizes', 'your_thumbnail_sizes');

    and then create a new page with this shortcode [your-sizes] to display the sizes.

    Best regards,
    Mike

    #1203246

    Each of those images are using the original full-size image and not the 495 image.

    You mean post?

    But it is not using full size, it is a 404 error.

    I get this:

    
    Array
    (
        [1536x1536] => Array
            (
                [width] => 1536
                [height] => 1536
                [crop] => 
            )
    
        [2048x2048] => Array
            (
                [width] => 2048
                [height] => 2048
                [crop] => 
            )
    
        [widget] => Array
            (
                [width] => 36
                [height] => 36
                [crop] => 
            )
    
        [square] => Array
            (
                [width] => 180
                [height] => 180
                [crop] => 
            )
    
        [featured] => Array
            (
                [width] => 1500
                [height] => 430
                [crop] => 
            )
    
        [featured_large] => Array
            (
                [width] => 1500
                [height] => 630
                [crop] => 
            )
    
        [extra_large] => Array
            (
                [width] => 1500
                [height] => 1500
                [crop] => 
            )
    
        [portfolio] => Array
            (
                [width] => 495
                [height] => 400
                [crop] => 
            )
    
        [portfolio_small] => Array
            (
                [width] => 260
                [height] => 185
                [crop] => 1
            )
    
        [gallery] => Array
            (
                [width] => 845
                [height] => 684
                [crop] => 
            )
    
        [magazine] => Array
            (
                [width] => 710
                [height] => 375
                [crop] => 
            )
    
        [masonry] => Array
            (
                [width] => 705
                [height] => 705
                [crop] => 
            )
    
        [entry_with_sidebar] => Array
            (
                [width] => 845
                [height] => 321
                [crop] => 
            )
    
        [entry_without_sidebar] => Array
            (
                [width] => 1210
                [height] => 423
                [crop] => 
            )
    
        [medium_large] => Array
            (
                [width] => 768
                [height] => 0
                [crop] => 
            )
    
        [shop_thumbnail] => Array
            (
                [width] => 120
                [height] => 120
                [crop] => 
            )
    
        [shop_catalog] => Array
            (
                [width] => 450
                [height] => 450
                [crop] => 
            )
    
        [shop_single] => Array
            (
                [width] => 450
                [height] => 999
                [crop] => 
            )
    
    )
    

    How can I regenerate those 30 ones. I don’t want to regenerate 50,000 images.

    Thanks.

    #1203576

    Hi,
    It looks like your “portfolio” size, 495, is activate so they should regenerate.
    The Regenerate Thumbnails has the option to skip over images that already have correctly-sized thumbnails.
    2020-04-14_074934.png
    This should leave only the missing ones to regenerate.

    Best regards,
    Mike

    #1203591

    It goes for all images that exists and marks 8 days for the job.

    I need to update 30 posts. Manually if it’s the case.

    How to regenerate “ONLY” the missing images.

    Thanks.

    #1203967

    Hi,
    It looks like WP-CLI can only generate thumbnails for images missing image sizes with [--only-missing] , if you know how to use WP-CLI Here is the official site. This answer says it takes about 30 seconds for this to correct 4000 images.
    But I didn’t find an alternative to this or a plugin to do the same, perhaps I missed it.
    Did you try to manually regenerate one image to see if this helps?

    Best regards,
    Mike

    #1204019

    How can I regenerate it manually?

    Thanks.

    #1205057

    Hi,
    The plugin adds this option next to the media names
    2020-04-18_113720.png

    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.