php - Wordpress `get_the_post_thumbnail` Source URL -


this return formatted html <img ... > tag.

$thumb_id = $post->id;  $picturelink = get_the_post_thumbnail($thumb_id, 'medium'); 

what function can use 'src' tag value?

i tried other wp functions attachments these did not return useful reason.

i accept wp function or parser extract src tag's value.

update: parser extract src tag's value.

$doc = new domdocument(); $doc->loadhtml($picturelinkhtml); $xpath = new domxpath($doc); $picturelink = $xpath->evaluate("string(//img/@src)"); 

you can lot easier parsing it. first need attachment id post id. can grab source includes url, width , height. here more information.

$image_id = get_post_thumbnail_id($post->id); $image = wp_get_attachment_image_src($image_id, 'large');  echo $image[0];  

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -