WordPress.org

Ready to get started?Download WordPress

Forums

Get the Image
image 'size' not working with 'image_scan' (3 posts)

  1. bullseyedesigns
    Member
    Posted 1 year ago #

    Hi all, this is a great plugin but i seem to be stuck with 1 little part...
    I am using the Twenty Twelve theme but it's only in my localhost at the moment so i can't give an address to look at the site, but I have the get_the_image function in my 'content.php' file in the section for "Only display Excerpts for Search", as below...

    <?php if ( is_search() || is_archive() ) : // Only display Excerpts for Search and Archive ?>
    <div class="entry-summary">
     <div class="excerpt-thumb">
    
    <?php if ( function_exists( 'get_the_image' ) ) {
      get_the_image( array(
        'size' => 'thumbnail',
        'image_scan' => true
      ) );
    } ?>
    
     </div>
    <?php the_excerpt(); ?>
    </div><!-- .entry-summary -->

    The problem is that the images that are inserted from the actual post content ('image_scan' => true) are not displayed as the thumbnail ('size' => 'thumbnail').

    Other images that are from the posts Featured Image are correctly displayed as the image thumbnail.

    Am i doing something wrong with the code to get it to display the thumbnail of an image within the post, or do i have to do something else like add ('width' => '150') & ('height' => '150'), which would squash some images as they are not perfectly square in shape, so is not ideal.

    Hope someone can help.
    Thanks,
    Ian

    https://wordpress.org/plugins/get-the-image/

  2. Justin Tadlock

    Plugin Author

    Posted 11 months ago #

    The image_scan argument is meant specifically for pulling an image URL directly from content. It has no "awareness" of whether there are various sizes of that particular image because, for all the script knows, that image is from Flickr, some third-party site, or many other possibilities. However, I am working on a slight workaround for this with images that have been added via the media library and have an associated ID.

  3. bullseyedesigns
    Member
    Posted 11 months ago #

    Oh right, i just about understood that! lol
    I'll look forward to seeing that update, as it seems like that's what i need.
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic