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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |