Extract image path from img tag variable


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $thumbnail_id=get_the_post_thumbnail($post->ID);
  2. preg_match ('/src="(.*)" class/',$thumbnail_id,$link);
  3. echo $link[1];

Report this snippet


Comments


You need to login to view comments.