有没有办法在 Firefox 或 Chrome 中使用 imagegrabwindow() ?

发布于 2024-09-03 18:58:56 字数 401 浏览 0 评论 0原文

我正在尝试用 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 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏已如深秋| 2024-09-10 18:58:56

您可以使用命令行的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文