This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Website screenshots using PHP
I want to create a script that will show the thumbnail of a site (let's say 400*300px ). I don't want sites like www.bitpixels.com .
So the answear could come in 2 ways:
1) You explain how could I take the screenshot of a website (using only PHP,ajax, etc,... no .NET or other stuff like that :D )
2) You know a website that offers this type of service for free and there's no limitation in the number of thumbs you can get, or their size.
You may want to try wkhtmltopdf (webkit-based html to pdf conversion), it also contains wkhtmltoimage, a version of it that outputs images. It's open source and if you have any sort of dedicated machine you should be able to use it. Otherwise I am not sure. Since it is webkit based it should provide you with a decent rendering of the page too.
Another great tool for this is PhantomJS
Related
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to save webpage as a image file using PHP?
I would like to create an image on the server using a url string that is given.
I want a screen shot of a website to be created.
Is it possible with PHP GD , if so how ?
Thanks
You need something like PhantomJS to do it. This can be called from PHP.
Pretty sure GD can't handle this by itself. You'd need an HTML renderer too.
As far as I know, there is no existing PHP-Lib, which can do this. PHP-GD has to do with graphics, but you cant do this with it. Even if: What will happen, if the Site uses Javascript to enable certain important parts of a site? Or even images or other resources, that require long running requests? Or consider sites using flash... There are some tools for linux to take screenshots in batch - configurable with timer etc.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Website screenshots using PHP
how can i take a screen shot and save it in PHP? I wana take a screen shot a users screen and save it to user's machine when he/she clicks on save button. Is there any way to do this??
You can't do this in PHP.
You could do this using HTML5/Javascript, something like HTML2Canvas does.
Your problem with that would be compatibility with older browsers. So using this would depend on who the website is aimed at.
You have to understand one thing that PHP is a server side script and nothing to do with real time browser needs. You may try JavaScript with some library like jQuery to capture the screenshot. Then you may pass that image via AJAX and there, you can definitely use PHP to save the image into your server directory.
this stackoverflow question may help you.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Create a PDF file with PHP
I have created invoice generator using javascript. well I am able to work on it. Now what I have to do is I have to generate the data in the pdf which are available in the invoice. I tried some but none work out. So If there is anyone who can help me out?
Thanx in advance
I have used "webkit html to pdf" (wkhtmltopdf) several times.
It worked well for me, although working with page breaks is a bit of an hassle.
PDF cannot be generated at the client side (I mean with Javascript). You will need to process the invoice data at the server side using a PDF library and write to a URL location, so that it can be downloaded or opened in a browser.
TCPDF is a good tool to generate PDF with PHP. See this link.
Also see this question.
This question already has answers here:
Closed 12 years ago.
Possible Duplicates:
How can I generate a screenshot of a webpage using a server-side script?
Taking screenshot of a webpage programmatically
How can I make a script in PHP for take a screenshot of a URL?
When I take a URL as an input I would lile to get a screenshot for that URL.
A screenshot is taken from a browser. The only way to do this from server-side PHP code is to make a call to a browser that lives on the server, ask it to go to the URL, and ask it to take a screenshot, and place it somewhere or return it over socket.
Instead of a browser standalone EXE file, you could also use a library that you can call from PHP which has HTML rendering capabilities.
Take a look at these similar Stack Overflow questions, they might help:
Taking screenshot of a webpage programmatically
Programmatically get a screenshot of a page
How can I generate a screenshot of a webpage using a server-side script?
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Screenshot of current page using PHP
How to convert HTML to image with PHP , have idea!!!
If you have Python, PyQt4 and Webkit installed on your server, you can use Webkit2PNG to do this: it downloads the page, fires up the Webkit rendering engine, and takes a snapshot.
Note that this could be resource-intensive; also, rendering can differ in various browsers (and in IE).
In order to get an image of a web page, you need software that can render a web page (that is, lay out elements, apply styles, and so on). Such software is typically called a "browser".
It's possible to automate a browser from PHP, using COM (like in sAc's answer) on windows, for example.