如果您绝对必须具有 HTML 中给出的精确像素尺寸,然后您可能需要编写一个小的 DOM 解析脚本来迭代所有 IMG 元素。这是一个简单的(未经测试的)PHP 示例。
$dom = new DomDocument();
$dom->loadHTMLFile('http://some-url');
$images = $dom->getElementsByTagName('img');
foreach($images as $image){
$src = $item->getAttribute("src");
// Get other attributes as needed, styles, width, etc...
}
ETC...
I know this is an older question - but it came up in my searching.
Since webpages just give the URL's and Display dimensions up to the Browser, it is the browsers job to display the proper size... however the browser also takes into consideration any zoom settings, or other considerations, etc that you may have set. In addition some elements may have relative sizes that change depending on your browsers viewport, desktop vs mobile as an example. So getting an exact pixel for pixel download may give you with false positive results that are tailored just to the downloading software or browser.
Your best bet (although not a prewritten piece of software like you asked) might be to download a list of all image resources (use a tool like ones others have mentioned - I like this one: http://www.webalyzing.com/free-seo-tools/image-extraction.php)
If you absolutely had to have the exact pixel dimensions as given in the HTML, then you may need to write a little DOM parsing script that iterates through all of the IMG elements. Here is a simple (untested) example in PHP.
$dom = new DomDocument();
$dom->loadHTMLFile('http://some-url');
$images = $dom->getElementsByTagName('img');
foreach($images as $image){
$src = $item->getAttribute("src");
// Get other attributes as needed, styles, width, etc...
}
发布评论
评论(3)
我知道这是一个较老的问题 - 但它出现在我的搜索中。
由于网页只是将 URL 和显示尺寸提供给浏览器,因此浏览器的工作就是显示正确的尺寸...但是浏览器还会考虑您可能设置的任何缩放设置或其他注意事项等。此外,某些元素的相对大小可能会根据您的浏览器视口而变化,例如桌面与移动设备。因此,获取像素下载的精确像素可能会给您带来仅针对下载软件或浏览器量身定制的误报结果。
您最好的选择(虽然不是像您要求的那样预先编写的软件)可能是下载所有图像资源的列表(使用其他人提到的工具 - 我喜欢这个:http://www.webalyzing.com/free-seo-tools/image-extraction.php)
如果您绝对必须具有 HTML 中给出的精确像素尺寸,然后您可能需要编写一个小的 DOM 解析脚本来迭代所有 IMG 元素。这是一个简单的(未经测试的)PHP 示例。
ETC...
I know this is an older question - but it came up in my searching.
Since webpages just give the URL's and Display dimensions up to the Browser, it is the browsers job to display the proper size... however the browser also takes into consideration any zoom settings, or other considerations, etc that you may have set. In addition some elements may have relative sizes that change depending on your browsers viewport, desktop vs mobile as an example. So getting an exact pixel for pixel download may give you with false positive results that are tailored just to the downloading software or browser.
Your best bet (although not a prewritten piece of software like you asked) might be to download a list of all image resources (use a tool like ones others have mentioned - I like this one: http://www.webalyzing.com/free-seo-tools/image-extraction.php)
If you absolutely had to have the exact pixel dimensions as given in the HTML, then you may need to write a little DOM parsing script that iterates through all of the IMG elements. Here is a simple (untested) example in PHP.
Etc...
我认为你只能手动完成。有一个名为“pixlrgrabber”的 Firefox 扩展可以帮助您。
https://addons.mozilla.org/en-US/firefox /addon/pixlr-grabber/
示例图像:
I think you can only do it manually. there is a firefox extention called "pixlr grabber" that can help you.
https://addons.mozilla.org/en-US/firefox/addon/pixlr-grabber/
Sample image:
即使这个小工具也可以从网页 http://www.prowebguru 中提取图像。 com/2011/12/free-online-image-extractor/
即使你也可以尝试这个http://www.wikihow.com/Download-All-Images-on-a-Web-Page-at-Once
Even this small tool extracts images from webpage http://www.prowebguru.com/2011/12/free-online-image-extractor/
Even you can try this http://www.wikihow.com/Download-All-Images-on-a-Web-Page-at-Once