You guys are gonna hate me for this, but .. I've done a lot of messing around with image galleries, and thumbnailing, and perl and image magick and gd... - and Just a few weeks ago I stumbled again on command line mogrify, convert, etc. And I'm affraid for this situation, it's the best answer.

ptum, chances are you are hosted on a linux server. You got shell? There's a 50/50 chance you got access to something that will blow your mind. Mogrify- it changes images in place, via simple command line arguments, you can resize, crop, whatever.. all of the images you want to. It's fast, it's effective. You have to be careful not to overrite your old images. I just made a gallery out of my 712 photos in the time it takes to upload the images.

Imagine you have:
public_html/images/md (here are your images that you uploaded)

change to the parent directory (images). then run command
mkdir sm
and copy all the images there
cp ./md/*jpg ./sm/

Then run
mogrify -resize 100x100 ./sm/*jpg
done. All the images in public_html/images/sm are thumbnails.

For the html, I hacked this together.. i run it locally and upload the output.

#!/usr/bin/perl use strict; use Cwd; my $cwd = cwd(); my $date = '<p>last update: '. `date`.'</p>'; my $preload=qq|<html><head> <style> .tmbs span{ margin:4px; } </style> </head><body> <div style="display:none">|; my $output = qq|$date <p>sorted reverse alphanum</p> <div class="tmbs">|; look(); $output.="</div></body></html>"; output(); exit; sub look { for ( split(/,/, `ls -rm "$cwd/md"`) ) { my $filename = $_; $filename=~s/^\s+|\s+$//g; $preload.=qq|<img src="./sm/$filename">|; $output.=qq|<span><a href="./md/$filename"><img src="./sm/$fil +ename" alt="$filename"></a></span>\n|; } $preload.='</div>'; return; } sub output { print $preload; print $output; }

(hey.. remember it's a hack!!! this should not be run on a server!)I run it on my local machine, i change to the parent dir to ./sm and ./md and.. # perl /path/to/script.pl > ./index.html Then I can upload the html. I guess you could do it on the server, but this way you end up with static content.

And oh yeah, your sysadmin might freak out if you run mogrify on like a thousand images. It could suck up 30% cpu or so.


In reply to Re: Image uploading and server-side resizing by leocharre
in thread Image uploading and server-side resizing by ptum

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.