How to create thumbnails or preview for links to websites?
I'd like to be able, being provided a link to a website for example, to generate a th开发者_如何学JAVAumbnail of that website page much like does the 'new tab' page of Chrome for example.
Is it possible with PHP?
Look into using wkhtmltopdf. It is a linux binary that generates PDF/PNG images of web pages using the webkit engine.
It is not possible with PHP, but you may use PHP to call another application. Example is to use http://derailer.org/paparazzi/ on the Mac. You can call this from PHP.
you have to start a web browser on the server (via exec()
), which renders the page and saves it as an image. For example you can do this with firefox and savepng plugin. With plain PHP you won't be able to do this, unless you do not implement an HTML/CSS rendering engine.
Isn't it simpler to call a webservice? http://www.webresourcesdepot.com/10-free-website-thumbnail-generation-services/
You need to have strong knowledge of Linux administration. As Darhazer posted, using exec command you can connect wkhtmltopdf, or similar tools, with PHP frontend. You also need to have a linux box, that does not have safe mode ON = this eliminate us One of these examples may be http://www.domdigger.com/screenshots/ (you can set up weekly automated screenshots for free there as well). Hope that helps.
精彩评论