leads me to believe wp_get_attachment_image_src( $thumb_id, array(100, 100) )<0> would certainly return a 100x100 thumbnail, however it constantly just returns the full-sized image.

You are watching: Wp_get_attachment_image_src

Any help would be considerably appreciated.


I think this password will aid you:

$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), "", false, "" );echo "



... Leads me to think wp_get_attachment_image_src( $thumb_id, array(100, 100) )<0> would return a 100x100 thumbnail...

That isn" rather what happens. Many of the occupational is excellent by image_downsize() together you deserve to see from close to the optimal of the wp_get_attachment_image_src() :

692 // acquire a thumbnail or intermediate picture if there is one693 if ( $image = image_downsize($attachment_id, $size) )694 return $image;If you look in ~ the notes because that that function you will see:

134 * The URL can be the original image, or it can be a resized version. This135 * function won" develop a brand-new resized copy, it will just return one already136 * resized one if that exists.What you gain (near as I can tell) is the nearest dimension to the one requested with an array containing the requested photo dimensions or the actual photo dimensions if the asked for size is larger than the biggest image. You room expected to execute the remainder with HTML and also CSS.

boost this answer
answer Jul 1 " at 2:31

62.8k1212 gold badges7373 silver- badges164164 bronze badges
include a comment |
you require to have predefined picture sizes, WP have actually 3 default sizes as 100x100 thumbnail, 300x300 medium and 800x800 large, and also I have an aditional size dubbed img-polaroid 700x320 identified on functions.ini.

See more: Do Androids Dream Of Electric Sheep Chapter Summary & Analysis

So the password to acquire images is:$image_id=get_post_thumbnail_id();$image_url = wp_get_attachment_image_src($image_id,"";$image_url=$image_url<0>;

"" is the "$size" retreived 700x320, and also the method to publish the photo is:img src=" echo $image_url" class="" style=" 0px 15px;"

Where class="" is the real size come print choose 100x100 or 200x100 with format of polaroid photo defined on CSS styles; or you have the right to use inside img html code heigh=100 wight=100. Through both methods the image will be clean and good definition. Because that my purposes img-polaroid has a size 320x200 and also defined likewise as responsive size.

If you get the picture $image_url = wp_get_attachment_image_src($image_id,""; and tries to print on higher size the photo will it is in blurred. ***

So try to acquire the photo size closest come the dimension you have to print to no overload your page