Info
- 2 posts
- 2 voices
- Started 2 years ago by psycheangels
- Latest reply from chrishajer
- This topic is not a support question
extract image from post content
-
- Posted 2 years ago #
function get_post_img(){ global $bbdb; $topic_id_ft = get_topic_id(); //topic id for getting text of first post of the topic $first_post = (int) $bbdb->get_var("SELECT post_id FROM $bbdb->posts WHERE topic_id = $topic_id_ft ORDER BY post_id ASC LIMIT 1"); $content = substr(strip_tags(strip_shortcodes(get_post_text($first_post))),0); preg_match('/\[img\](.*?)\[\/img\]/i', $content, $matches); $src = $matches[1]; echo $src; }modified from here http://bbpress.org/forums/topic/show-a-snippet-of-the-post-under-the-topic-title#post-39260
-
- Posted 2 years ago #
What are you using this for?
-
You must log in to post.