thumbnail url
-
wp_get_attachment_thumb_url() returns garbage for me.
It mixes a web url with an absolute url.How do I fix this? How do I get the thumbnail of one attachment in the post?
My code:
<?php $files = get_children('post_parent='.get_the_ID().'&post_type=attachment&post_mime_type=image'); if($files){ $keys = array_reverse(array_keys($files)); $j=0; $num = $keys[$j]; $image=wp_get_attachment_image($num, 'large', false); $imagepieces = explode('"', $image); $imagepath = $imagepieces[1]; $thumb=wp_get_attachment_thumb_url($num); //Display image ?> <img src="<?php echo $thumb; ?>" width="156" height="103" alt="<?php the_title_attribute(); ?>" /> <?php } else { ?> <img src="<?php bloginfo('template_url'); ?>/images/pic_empty.gif" alt="<?php the_title_attribute();?>" width="156" height="103" /> <?php } ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘thumbnail url’ is closed to new replies.