使用 php 从 html 生成图像

发布于 2024-11-24 04:24:51 字数 136 浏览 4 评论 0原文

出于某些安全原因,我想生成一个基于 Google 日历嵌入 iframe 的图像,以便能够在不允许 iframe 的网站上显示它。

有没有可以从 html 创建图像的 php 库?

该脚本必须可以在 Linux 服务器上执行。

For some security reasons, I would like to generate an image based on Google Calendar embed iframe, to be able to show it on a website who don't allow iframes.

Is there any php library to create an image from html?

The script have to be executable on a linux server.

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

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

发布评论

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

评论(2

初见终念 2024-12-01 04:24:51

该库 wkhtmltoimage 运行良好。

我创建了一个页面来嵌入谷歌日历(无法直接访问该网址)。

我从此页面生成一张图片,并将该图片链接到网站上我的个人资料上。

非常感谢您的评论。

The library wkhtmltoimage works perfectly.

I have created a page to embed the google calendar (the url can't be reach directly).

I generate a picture from this page and I link this image on my profile on the website.

Thanks heaps for the comments.

桃扇骨 2024-12-01 04:24:51

GD 库中的函数可以输出当前屏幕的图像

<?php
//All of your normal code would go here
//But before exiting, grab a snapshot
$image = imagegrabscreen();
imagejpeg($image,"my_screenshot.jpeg");
imagedestroy($image);
?>

或者使用

websnapr 让您捕获 (几乎)任何网页。让您的访问者在点击之前立即可视化任何网页。提高网站流量、点击率和网站粘性。

functions from the GD library to output an image of the current screen

<?php
//All of your normal code would go here
//But before exiting, grab a snapshot
$image = imagegrabscreen();
imagejpeg($image,"my_screenshot.jpeg");
imagedestroy($image);
?>

Or use

websnapr lets you capture screenshots of (almost) any web page. Allow your visitors to instantly visualize any web page before clicking. Increase site traffic, click-through rate and site stickiness.

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