tags:

views:

143

answers:

3

I want to experiment with creating images/thumbnails of PHP output. A place where one would use this is in a CMS with various modules, and then have a thumbnail of how the output of how each module looks. This should include images and all.

Any tips/ideas how I would go about doing this?

A: 

You need to make sure the GD library is turned on in your php.ini file.

Then have a surf through php.net on the GD library functions that cover how to manipulate images.

Good luck!

Evernoob
Please read question well before posting such strange answers ;) GD will not help to make a screenshot of the page in browser.
FractalizeR
A: 

I have just implemented thumbnail system in my project, so I can give you some useful tips:

  • Define script for getting thumbnails, like /thumb.php?file=/some/file.jpg
  • Cache your result. In your script, check if thumbnail already was done before, if so, just send cached file, if not, generate thumb, save, then send. Generating thumbnail is not fast process.
  • You can empty your thumb-cache folder with cron, to be sure that they always are up-to-date.
  • It would be easier to store thumbnails with str_replace '/' character into other one, like ' ' (space). With that you won't need to recreate folder's structure (when you get request for /some/file/image.gif it would be easier to get "some file image.gif").
Thinker
I still don't see from your explanation how to exactly make this thumbnail.
FractalizeR
+3  A: 

i believe that you want to create the thumbnail/image of the rendered html, this is not going to be easy. Cause you will need to use a 3rd party screenshot component for this. You will save the html in a temp file and pass that component the url of that file and it will take a screenshot of it and then create the image which in turn u can use in your own application.

Because the rendering would differ from browser to browser and is explicitly a browser/client feature, i dont think this can be done with pure PHP.

Sabeen Malik
Thought as much. :| But thanks for the answer!
Constant M