Skip to content

Instantly share code, notes, and snippets.

@charleyramm
Created March 2, 2014 00:15
Show Gist options
  • Save charleyramm/9299750 to your computer and use it in GitHub Desktop.
Save charleyramm/9299750 to your computer and use it in GitHub Desktop.
!/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";
}
@charleyramm
Copy link
Author

./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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment