jmnthe3rd has asked for the wisdom of the Perl Monks concerning the following question:

I’m looking for a way to automatically create thumbnails out of the files my users upload. I am currently using tripod as my web host. They offer CGI capabilities, but do not offer support for them. I will break down the ideas I already have on the matter to see if anyone is able to answer them individually. Is there any way to install imagemagik or GD without having direct access to the server? I’m looking for a way to make it run simply by uploading it to my cgi-bin folder & or perhaps hand editing a line or two of my cgi file. Are there any Perl/CGI scripts that will automatically create thumbnails, that do not require GD or imagemagik & also do not require similar instillation? Does anybody know of any & or have experience with services that offer free hosting of GD/Imagemagik/php/anything that would automatically make thumbnails for me? I also had one last idea that may seem a little odd, but if you answered no to all or the above, I’d really appreciate any thought or suggestions on it. http://www.imageweb.info/ offers free image hosting & thumbnail generation, give it a try to see what I mean. Would there be any way of somehow integrating this interface into my own? Ideally a user could upload a file to imageweb.info then I’m looking for a way to grab the html/php data on the output page, that’s all I’d really need is a way to automatically copy the url of the thumbnail on imageweb to a textfile on my server. Paid hosting is not an option. Thank you so much, Joe

Replies are listed 'Best First'.
Re: Auto Thumbnails?
by thekestrel (Friar) on Apr 02, 2005 at 22:38 UTC
    Hi
    Have a look at iGal its in perl.

    Regards Paul
      From the igal README:

      iGal needs Perl to run and either cjpeg/djpeg/pnmscale (from libjpeg) or ImageMagick to generate your thumbnails. These come standard with most Linux distributions today.

      igal is a command line tool, so if you take that approach you will probably need to adapt it to your own code. Looking at the code, igal calls either imagemagick or cjpeg using system, so if you adapt something from this code you'll have to be very careful about validating filenames etc, to avoid attackers being able to run arbitrary code on your webserver.

      As far as installing modules without direct access to the server goes, have a look at this node. BUT, both GD & Image::Magick act as wrappers around existing libraries. If either of these libraries are installed on the ISPs web server, you could be in luck.

      With the 'imageweb.info' approach, I suppose you could upload the file to your own script, then use LWP to upload the file from your script to imageweb.info & screen scrape the returned URL. Quite messy, and probably quite slow, but possible. If the client browser uploads the file direct to imageweb.info as you initially suggest, you won't have a connection from your script to the returned page to be able to grab the returned URL. The other problem is if imageweb.info changed their upload/response page drastically your script would stop working.

      There is also this site, which returns a scaled graphic rather than a URL.

      g0n, backpropagated monk