You are here:  » Get image from description !


Get image from description !

Submitted by fraizor on Fri, 2016-08-19 13:54 in

hi
i have rss sources
some of them does have the image link in the description !

{link saved}

or

{link saved}

how can i deal with that ?

Submitted by support on Fri, 2016-08-19 14:28

Hello fraizor,

You could try extracting the image src from the description with preg_match() - have a go with something like;

  if (preg_match("/src=\"(.*)\"/U",$record["DESCRIPTION"],$matches))
  {
    $src = $matches[1];
    print "<img src='".$src."' />";
  }

Hope this helps!
Cheers,
David
--
MagicParser.com

Submitted by fraizor on Mon, 2016-08-29 19:43

Great it worked !
now i can get the images , but i will also need the description alone
how can i get the description ?

Submitted by support on Tue, 2016-08-30 08:12

Hi fraizor,

As the image is included as HTML markup, you could use strip_tags() to return just the description text, for example:

  print strip_tags($record["DESCRIPTION"]);

Cheers,
David
--
MagicParser.com

Submitted by fraizor on Thu, 2016-09-01 13:59

Perfect ! thank you...