Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1395995
    brightboysquad
    Participant

    Hi team. I have read the forum regarding the way the Masonry blog displays the default (large) blog images and the displays them to 1/3 of the original size. Question: Is there a way for me to hack that and to force the blog to use another image? An image I have optimized to the smaller dimensions? (All my client’s images are already optimized and compressed but the blog is slow to load because of all the images that get displayed at only at 1/3 of their original size).

    Question 2: If there is no way to use a smaller file, is there a way to not use any images at all?

    #1396033
    Lely
    Moderator

    Hi There,

    Since the issue is loading time, why not use caching and CDN to host your images? Please check this article:https://community.theme.co/kb/performance/

    Hope this helps.

    #1396358
    brightboysquad
    Participant

    Hi, the issue is not a CDN. The issue is the images. Please understand I love X, I only develop with X. BUT! This issue is something ALL my clients face sooner or later. I understand your position; it’s not on your radar for now. I’d like to know id there is anything I can do to make the blog overview page move faster myself.

    Will this help? “Set the default Featured Image (formerly Post Thumbnail) dimensions. To register additional image sizes for Featured Images use: add_image_size().”
    https://codex.wordpress.org/Function_Reference/set_post_thumbnail_size

    #1396429
    Darshana
    Moderator

    Hi there,

    To assist you with this issue, we’ll first need you to provide us with your URL. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

    #1396489
    brightboysquad
    Participant
    This reply has been marked as private.
    #1396642
    Rupok
    Member

    Hi there,

    It’s loading pretty fast on my end. Still you can optimize the featured images a bit more.

    Cheers!

    #1396656
    brightboysquad
    Participant

    Hi, yes just a tad bit indeed, I know. Thats not where I am looking to find improvements. I want to improve the 90% too large images that are being scaled down in HTML/CSS as I hoped you understand by know.

    Look, I totally understand you are working on other great stuff. I do, really. All I want is to find a way to create smaller images myself. This is something that affects all my client’s blogs.

    I also understand if you don’t know if using an additional image sizes for Featured Images (as I mentioned above) will work. Please let know if thats the case. I can fill you in if I find a way that works, ok?

    #1397383
    Christian
    Moderator

    Please add the code below in your child theme’s functions.php

    function x_featured_image( $cropped = '' ) {
    
      $stack     = x_get_stack();
      $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;
    
      if ( has_post_thumbnail() ) {
    
        if ( $cropped == 'cropped' ) {
          if ( $fullwidth ) {
            $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL );
          } else {
            $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL );
          }
        } else {
          if ( $fullwidth ) {
            $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL );
          } else {
            $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
          }
        }
    
        // Configure this
        $thumb = get_the_post_thumbnail( NULL, 'medium', NULL );
    
        switch ( is_singular() ) {
          case true:
            printf( '<div class="entry-thumb">%s</div>', $thumb );
            break;
          case false:
            printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>',
              esc_url( get_permalink() ),
              esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
              $thumb
            );
            break;
        }
    
      }
    
    }

    Change the setting in get_the_post_thumbnail in this part of the code

        // Configure this
        $thumb = get_the_post_thumbnail( NULL, 'medium', NULL );

    For more details, please see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/

    Thanks.

    #1397398
    brightboysquad
    Participant

    Why Christian, thank you very much for contributing! I will pick this up right away! Muchos Graçias.

    #1397590
    Christian
    Moderator

    You’re welcome.

    #1397887
    brightboysquad
    Participant

    HUUUUUUGE difference! Wow. Excellent! Thank you Christiaan. We’ve improved loading with at least 100%! Fully loaded was 15.5 sec, now 3.9. (Also added a different caching plugin, W3TC). I salute you sir!

    #1398393
    Friech
    Moderator

    You’re more than welcome, glad we could help.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1395995 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>