Page 1 of 1

Solved:Help for a function get_img_basic

Posted: Thu Jun 05, 2008 2:55 am
by gosu
Edit: I found error in the script, this works fine ;)

The function returns the link of the image when it sees <img src=""> (i think)
It works fine when there is a text with image src tag but...
I need to make it work for:

<img src=\"".$config['http_home_url']."uploads/".$modul_filesdir."/{$cat_i_down[$row['category']]['dir']}/thumbs/{$row['screenshot']}\">

Any help is greatly appriciated!

The function:

Code: Select all

function get_img_basic($text){
    preg_match('|<img(.*) src="([^"]*)"[^>]*>|is', $text, $out); 
    return $out[2];
};
The working result should be looking like this:

Code: Select all

 $img =  get_img_basic("<img src=\"".$config['http_home_url']."uploads/".$modul_filesdir."/{$cat_i_down[$row['category']]['dir']}/thumbs/{$row['screenshot']}\">");