有没有办法在 Firefox 或 Chrome 中使用 imagegrabwindow() ?
我正在尝试用 PHP 以编程方式生成网站缩略图。为此,我将 imagegrabwindow() 与 COM 对象一起使用:
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate($pre.$URL);
while ($browser->Busy)
{
com_message_pump(4000);
}
$img = imagegrabwindow($handle);
我想知道是否有任何方法可以使用 Firefox 或 Chrome 执行相同的操作?我可以使用 PHP COM 调用其中任何一个吗?
I'm trying to generate website thumbnails programatically in PHP. To do this, I'm using imagegrabwindow() with a COM object:
$browser = new COM("InternetExplorer.Application");
$handle = $browser->HWND;
$browser->Visible = true;
$browser->Navigate($pre.$URL);
while ($browser->Busy)
{
com_message_pump(4000);
}
$img = imagegrabwindow($handle);
What I'm wondering is if there is any way to do the same thing with Firefox or Chrome? Can I invoke either of them with PHP COM?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用命令行的 exec 命令来调用它们。 Firefox 的 Pearl Crescent Page Saver 插件也将采用命令行参数来保存页面的捕获。
http://pearlcrescent.com/products/pagesaver/doc/#commandline
基本信息版本给你的灵活性不如他们的付费版本,但基本版本满足了我的需求。它也可能适用于非 Windows 系统,但我还没有尝试过。
我用 IE 和 imagegrabwindow 尝试了 Com 对象,但我得到了随机变黑的文档。由于没有找到任何帮助来解决这种情况,从命令行编写插件脚本似乎是下一个最佳可行的选择。
You can invoke them with an exec command to the commandline. The Pearl Crescent Page Saver plugin for Firefox will take commandline arguments to save a capture of the page as well.
http://pearlcrescent.com/products/pagesaver/doc/#commandline
The Basic version gives you less flexibility than their paid version, but the basic version met my needs. It may also work on non-Windows systems, but I haven't tried it.
I tried the Com Object with IE and imagegrabwindow and I just got randomly blacked-out documents. Not finding any help to resolve that situation, scripting a plugin from the commandline seemed the next best viable option.