1

i have an url="http://some url";

Is it possible to create an image of the url using php?

I tried using imagecreatefromjpeg but it accepts only image file as the input and not the url like "http://"

user475685
  • 8,041
  • 7
  • 26
  • 24
  • Do you mean a textual representation of the url string in image format, or a screenshot of the link destination? – Liam Bailey Jun 24 '11 at 06:52
  • 1
    Did you mean take a screenshot of a required url? – Eineki Jun 24 '11 at 06:52
  • Please clarify your question. If you're interested in taking a "screenshot" of the webpage at that URL, there's already a ton of questions about that: http://stackoverflow.com/search?q=create+screenshot+from+webpage – deceze Jun 24 '11 at 06:56
  • i want to take a "screenshot" of the webpage at that URL using either javascript or php. Is it possible? – user475685 Jun 24 '11 at 07:05
  • Please use the search, this question has been asked countless times. – deceze Jun 24 '11 at 07:11

3 Answers3

2

I'm not sure what you mean - do you mean create an image of the page itself? Then yes, it's possible. All you need to do is parse the html, fetch any css and parse it, add in images and process any javascript in the page.

Of course, it might take you a few years to build such an application, but it can be done. And at the end you'll have a browser written in php, which will be quite slow.

1

If you need to take a snapshot of a web url using just php you need an external tool like cutycapt.

It is quite invasive for a server (you need an X environment) but it the easiest solution to go at present.

Eineki
  • 14,773
  • 6
  • 50
  • 59
0

If you want to create an image with your url text in it then use something like, imagefttext, for more visit php.net/imagefttext, in case you want to take a screenshot of the webpage at given url, go to this SO link: Command line program to create website screenshots (on Linux)

Community
  • 1
  • 1
Kumar
  • 5,038
  • 7
  • 39
  • 51