用phantomjs和php加快图像生成过程

发布于 2025-01-20 14:13:38 字数 444 浏览 3 评论 0原文

因此,我有这个本地脚本generate.php它可以通过我的本地主机上的某些特殊文件夹结构进行循环,并使用php exec函数执行phantomjs脚本以生成缩略图(1200x800 )对于这些项目(这些只是网站/php/html)。

问题是,它真的很慢。我有大约18个不同的图像要生成,只需要30秒到一分钟,只有18张,这不是我想要的。是否有一个选项可以与PHP同时运行18 exec S,或者可能有一个可以一次处理许多图像的Phantomjs脚本。希望有人有一个主意。

foreach(folder level 1)
   foreach(folder level 2)
      exec(phantomjs render image)

So I have this local script generate.php that loops through some special folder structure of websites on my localhost and executes a phantomJS script using the PHP exec function to generate Thumbnails (1200x800) for these projects (These are just websites/php/html).

The problem is, that its really slow. I have about 18 different images to be generated and it takes from 30sec up to a minute for only those 18 which is not what I want. Is there an option to run those 18 execs concurrently with php or maybe there is a phantomJS script that can handle many images at once. Hope someone has an idea.

foreach(folder level 1)
   foreach(folder level 2)
      exec(phantomjs render image)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文