<?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://www.ads-software.com/plugins/get-the-image/
]]>this plugin uses get_the_image function to get thumbnail. How can I use it with your plugin’s widget?
Please help.
https://www.ads-software.com/extend/plugins/post-views/
]]>I’m using Get the Image plugin, and when requesting default image sizes of attached images, it works fine. But I have set up three cusom image sizes in my functions file:
* large-16×9
* medium-16×9
* small-16×9
When I request any of these sizes via the plugin, the custom size is added to the class of the image, but the url always falls back to the full size version of the image. If I change the image size request to “large”, it instantly works.
I’ve double checked the image upload folders, and all of these custom sizes exist. If I use the WP Featured Image tag, it works. I’m completely stumped.
Here’s the code I’m using.
<?php get_the_image( array('size' => 'medium-16x9', 'thumbnail_id_save' => true, 'link_to_post' => false, width => '100%', 'image_scan' => true, 'order_of_image' => 1)); ?>
Unfortunately can’t show a site example as this is on a development server.
]]><?php if(function_exists('get_the_image')) {
get_the_image(array('default_size' => 'medium', 'image_scan' => true, 'link_to_post' => false));}
else {
echo '<img src="/wp-content/themes/platform/img/nopostimage.png" alt="" title="" />';}?>
Any suggestions appreciated. Thanks.
]]>I would like to have it display the image I’ve chosen as the “Featured Image” instead.
I’ve tried a number of things, including this:
<?php get_the_image(array('custom_key' => array('Feature', 'Feature Image'), 'default_size' => 'full')); ?>
and this:
<?php get_the_image( array( 'custom_key' => array( 'Feature' ), 'default_size' => 'full' ) ); ?>
and a whole bunch of other versions of similar code. However none of it seems to work.
Can someone tell me:
1. Is the “Featured Image”…you know, the one I choose on the bottom right hand corner of the Posts window when I’m creating the post, be targeted by get_the_image without me having to do any coding other than fixing this line in the Loop?
2. Exactly what code to use?
Also, I don’t know if it makes a difference or not, but I use NextGen Gallery and have chosen the “Featured Image” from a NextGen gallery instead of a direct upload (when I choose the “Featured Image” when creating the post, the option to choose it from the NextGen Gallery is available so I used that instead of wasting space with a separate upload).
Thank you very much for your help.
]]>function custom_medium($postID) {
global $post;
$postID = $post->ID;
$custom = get_the_image( array( 'default_size' => 'large', 'link_to_post' => false, 'image_scan' => true ) );
update_post_meta($postID, 'medium', ''.$custom.'');
}
add_action('publish_post', 'custom_medium');
I’m using the Get The Image plugin to grab the first attached image for each post, and need to register what it finds as a custom field called “medium”.
As always, any help is greatly appreciated. Thanks in advance.
]]>