I'm working with PHP Simple HTML DOM and just discovered it can't read images from data-src
attribute or <img src
without http: eg; <img src="//static.mysite.com/123.jpg">
Is there any way to make it happen?
My code is:
if($htm->find('img')){
foreach($htm->find('img') as $element) {
$raw = file_get_contents_curl($element->src);
$im = @imagecreatefromstring($raw);
$width = @imagesx($im);
$height = @imagesy($im);
if($width>500&&$height>=350){
$hasimg = '1';
echo '<img src=\'' .$element->src. '\'>';
}
} // end foreach
} // end if htm