Reputation: 77
i would like to save image in original size from a given url.
For example, i have the following site: *
I am possible to get all the images from this url but the size is very small. All the images have an img tag with source looking like /fileadmin/media/images/cat_thumb/xxx.jpg
But the img tag is inside an a href link which is showing the image in fullsize. And i need this img, not the small one
Note that this size is only an example, and i am looking for some generic solutin to find images in original/thumbnail size.
Here is a code snippet i am using to save the small images...
$html = file_get_html($url);
foreach($html->find('img') as $element) {
echo url_to_absolute($url, $element->src), "</br>";
}
Upvotes: 0
Views: 736
Reputation: 3698
Your post is confusing so my answer could be off.
Something like this should set you on the right path (not tested)
$html = file_get_html($url);
foreach($html->find('img')->parent('a') as $element)
{
$page_url = url_to_absolute($url, $element->href);
$page_html = file_get_html($page_url);
}
But the only true way you can check an image width/height is by copying it to your server first and using getimagesize()
to get height and width.
Upvotes: 1