Created
March 2, 2014 00:15
-
-
Save charleyramm/9299750 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/usr/bin/perl -w | |
use strict; | |
use warnings; | |
use utf8; | |
#compiled from source like: http://www.imagemagick.org/script/perl-magick.php | |
use Image::Magick; | |
#rock through the directory index | |
my @files = <*.{jpg,jpeg,png,gif}>; | |
#print little thumbnails of all the images | |
foreach my $file (@files) { | |
my $image = Image::Magick->new(); | |
$image->Read($file); | |
$image->Resize('450x150'); | |
$image->Write(".t_$file"); | |
print "<a href=\"$file\"><img src=\".t_$file\"></a>\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
./thumbs > thumbnails.html
Thumbnails are named .t_filename.extension to be hidden from Apached directory index but still available to download. This may not work if your server refuses to serve files beginning with "." but it's quite tidy.