简体   繁体   English

Html / CSS制作网站的实时图片

[英]Html/CSS make a live picture of a website

I was looking to making a link on a website a live changing picture of wherever the link is taking it to. 我希望在网站上建立一个链接所在位置的实时更改图片链接。

For example: I have a link to Page A, so the picture will show the page A. If I want to change the color of Page A, I would not have to change any code on the link picture but just the code for the color on the page and the picture will so the color change. 例如:我有一个指向页面A的链接,因此图片将显示页面A.如果我想更改页面A的颜色,我不必更改链接图片上的任何代码,只需更改颜色的代码在页面和图片上将如此颜色变化。

You could use a commercial service like Shrink The Web who will provide an API for this feature. 您可以使用像Shrink The Web这样的商业服务,它将为此功能提供API。 It's a lot more intensive than just a bit of CSS/HTML.. 它比一些CSS / HTML要密集得多。

You could just use a small iframe . 你可以使用一个小的iframe I would layer a link over the top of it to prevent any interactions with that page itself. 我会在其顶部添加一个链接,以防止与该页面本身的任何交互。 Otherwise, scraping a screenshot will require more than just HTML and CSS. 否则,抓取屏幕截图将需要的不仅仅是HTML和CSS。

if i understood your question correctly, these are the possibilities for your problem. 如果我理解你的问题,这些是你的问题的可能性。

  1. Use Iframes, so that you can change the source of iframe with your changes and it will be reflected in every where it is used. 使用iframe,以便您可以使用更改更改iframe的来源,并将其反映在每个使用的位置。
  2. If you are using Jquery, knockout or any template engine, then you can create a template. 如果您正在使用Jquery,knockout或任何模板引擎,那么您可以创建一个模板。 so that you can change it and reuse it. 这样你就可以改变它并重复使用它。

There are free tools which do this, 有免费的工具,这样做,

you won't need to change the image, but they use cache and you may need to refresh the request to update image 您不需要更改图像,但它们使用缓存,您可能需要刷新更新图像的请求

  1. http://mozshot.nemui.org/ http://mozshot.nemui.org/
  2. http://www.websnapr.com/ http://www.websnapr.com/

they are very simple to use, as this link shows a very small shot of google and you can use at in a html img tag: http://mozshot.nemui.org/shot/small?http://www.google.com/ 它们使用起来非常简单,因为这个链接显示了一个非常小的谷歌镜头,你可以在html img标签中使用: http//mozshot.nemui.org/shot/small?http//www.google。 COM /

My suggestion: 我的建议:

The first one (mozshot) is open source, so you could simply download and edit it, put it on your own website to update the image frequently or even after each refresh (which would be live but takes a lot of resource) 第一个(mozshot)是开源的,所以你可以简单地下载和编辑它,把它放在你自己的网站上频繁更新图像,甚至每次刷新后(这将是实时但需要大量资源)

here is the source code for mozshot: http://github.com/sugi/mozshot 这是mozshot的源代码: http ://github.com/sugi/mozshot

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM