My apologies..
I'm using Windows 2000, ActiveState Perl version 5.6.1 if you
need to know that too.
Here is my current coding:
#!/usr/bin/perl
# Import Modules #
use File::Copy;
use Image::Magick;
use File::Find;
# Prompt for Directory #
print "Enter Directory: ";
chomp($dir = <STDIN>);
# Find Images #
find(\&mogrify, $dir);
# Resize Images #
# Write to thumbnails directory #
# With same filename extension #
sub mogrify {
$img = Image::Magick->new;
$img->Read($_);
# Test for Extensions #
if ($_ =~ /\.(\w+)$/) {
$ext2 = $1;
}
my $ext = $ext2;
$img->Resize('geometry' => "120x120", 'filter' => "Cubic");
$img->Write("$_"."-thumb"."\.$ext2");
}
# Make the directory of thumbnails #
system("mkdir thumbnails");
# Move all thumbnails to the thumbnails directory #
system("move *thumb*.*, thumbnails");
Sorry if the indentation's bad....
Is any of this the correct way to do it?
Thanks,
~firstbaseman83
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.