Forum Moderators: coopster & phranque

Message Too Old, No Replies

Script to generate thumbnails from websites

         

jez_kewler

12:21 am on Aug 8, 2004 (gmt 0)

10+ Year Member



Hi there,

I am looking for a perl (or maybe php) script that would generate jpg/gif thumbnail images for our link directory...

the whole should run on your webserver directly - without manual processing and even without a graphical display - immediately when links are added...

any help on that...

please note: thumbnails from specified URLs shall be generated just like a browser preview... no image thumbs...

thanks,j

kalos

7:53 am on Aug 8, 2004 (gmt 0)

10+ Year Member



If I understand this correctly you want to make thumbnails of a pre-existing gallery that may or may not be on your server, correct? Either way this is possible with ImageMagick (it's on Freshmeat.net, just look). From there it is just a matter of cycling through each directory and calling the convert app from ImageMagick. If the images are remote then you'll need to download them first, but that's a given.

Ian_Cowley

10:35 pm on Aug 8, 2004 (gmt 0)

10+ Year Member



I agree with kalos ImageMagick is great! I use it for all konds of things. Fron the command line for batch converting and in scripts. I ahve also used it on the fly to overlay a logo on user uploaded images, it's a great tool.

mattx17

3:31 pm on Aug 9, 2004 (gmt 0)

10+ Year Member



One way you can do it is you have a browser such as mozilla installed on the server, and you also have X running (and a window manager), you can get a screenshot this way:

Leave the browser window open, fully maximized, in your server's X session. Run the command (from your script):

mozilla -remote openURL('http://www.mysite.com')

This should open the URL up in the servers X session. Once that is done, take a screen shot with any of the available tools for X. We'll use xwd as an example:

xwd -frame -root -out myscreenshot.xwd

This will take a full screenshot of the X root window, which should have the browser window open at that URL.

After that, you may have to use ImageMagick or NetPBM to convert the file into something usable for the web.

Hope this helps, even if it just points you in the right direction.