使用 Javascript 或 PHP 保存网页中的图像
我用 jquery 编写了一个小的 javascript 应用程序,它通过 Google Feed API 获取 rss feed 并将其显示为图像网格。
代码如下所示:
<ul>
...
<li><a class="entry" href="LINK_TO_BIG_IMAGE" title="TITLE_OF_ENTRY"><img class="entry-img" src="THUMB_IMG" alt="" /></a></li>
...
</ul>
我想要做的是能够将所有图像一次保存在服务器上的文件夹中。现在,如果它在页面加载时执行此操作,我会很高兴。可以通过 JavaScript 实现吗?你有什么方向可以指点我吗?
提前致谢 !
I wrote a little javascript application with jquery which fetches a rss feed via the Google Feed API and displays it as a grid of images.
The code then looks like :
<ul>
...
<li><a class="entry" href="LINK_TO_BIG_IMAGE" title="TITLE_OF_ENTRY"><img class="entry-img" src="THUMB_IMG" alt="" /></a></li>
...
</ul>
What I want to do is to be able to save the images all at once in a folder on the server. For now I'd be happy if it does it on page load. Is it possible via Javascript ? Do you have some direction to point me to ?
Thanks in advance !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您关于将路径提交到服务器上的 php 脚本的评论将起作用(我不建议这样做,但它起作用)。
然后你的 php 可以像这样下载图像(未经测试,当你保存文件时,你需要从 $url 解析文件名)。
Your comment about submitting the paths to a php script on the server would work ( I wouldn't recommend doing it that way but it works).
Your php could then download the images like so (untested and you'd need to parse the filename from the $url when you go to save the file).