I am using Musea's general-images on my 3.2.5 page...
<br><br>
Whenever a user uploads an image that is i.e. only 90 px in width the
other sizes get created anyways, but obviously look pretty crappy...
Whenever this happens I would like this script to only create symbolik
links to the next smaller picture...
<br><br>
For example:<br>
User uploads 90 px picture.jpg --> 3 symbolic links to the original
get created: picture_large.jpg, pictures_medium.jpg, pictures_small.jpg
<br><br>
User uploads 110 px picture.jpg --> picture_medim.jpg (100px) gets
created, picture_medium.jpg AND picture_large.jpg are symbolic links
to the original
<br><br>
I have never done anything in perl before...
<pre>
#!/usr/bin/perl
#
# given an image file name, create small, medium, and large versions
of it,
# using the ImageMagick mogrify utility.
use strict;
my $filename=$ARGV[0];
my ($base, $ext);
unless ($filename =~ m/^(.+).(jpg|gif)$/) {
die "Invalid filename $filename";
}
$base = $1;
$ext = $2;
my %geom = (
large => "360x360>",
medium => "229x229>",
small => "100x100>"
);
my $size;
foreach $size (keys %geom) {
my $dest = "${base}_${size}.${ext}";
`cp $filename $dest`;
`/usr/local/bin/mogrify -geometry "$geom{$size}" $dest`;
</pre>