wp_get_attachment_image_src and related img functions not giving thumbnails
-
This is totally driving me crazy!
Many people state they use
$images =& get_children( ‘post_type=attachment&post_mime_type=image&post_parent=’ . $post->ID );
foreach( $images as $imageID => $imagePost )
echo wp_get_attachment_image($imageID, ‘thumbnail’, false);and apparently it works great
I personnally have
foreach($myposts as $mypost)
{
$imgs =& get_children(‘post_parent=’.$mypost->ID.’&post_type=attachment&numberposts=1&post_mime_type=image’);
if (empty($imgs))
{
echo ‘… default pic’;
}
else
{
foreach($imgs as $attachment_id => $img)
{
$image = wp_get_attachment_image_src($attachment_id, “thumbnail”, false);
var_dump($image);
[…]
}
}
}which is basically the same, but whatever parameter I send to wp_get_attachment_image_src as size (mostly “thumbnail” but it is said to be the default so I shouldn’t need to pass it), I ALWAYS get the original picture (not resized)!
And I have checked, the resized picture exists, it is just not fetched
Nobody else seems to have the same problem which is just so infuriating…
I could do it by adding myself the dimensions to the result (from toto.jpg to toto234x104.jpg) as it was before (the site has just been upgraded from an older version) but I don’t understand why this wouldn’t work as nobody else reported this problem
The previous version of the site had “iMax Width” and “Resize and Save”, I got rid of both of them, I tried to make a new article with an attached picture in case it was them storing the previous data in a different way, but it is exactly the same
Anyone has an idea of what is wrong?
- The topic ‘wp_get_attachment_image_src and related img functions not giving thumbnails’ is closed to new replies.