klasse, danke ! weißt du zufällig, ob man d anoch irgendwie den dateiname des bildes herausfinden könnte? kjannst dich am folgenden code orientieren:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
use strict;
use GD;
use Image::Size;
my ($width,$height);
my ($thumbnailwidth, $thumbnailheight);
my $max_height;
my $max_width;
my $relation;
my $big;
my $lit;
chdir("/usr/local/httpd/htdocs/thumbs/") || die $!;
for(glob("*.jpg"))
{
eval {
print "$_\n";
($width,$height) = imgsize($_);
($thumbnailwidth, $thumbnailheight) = ($width, $height);
$max_height = 80;
$max_width = 80;
$relation = ($height / $max_height) > ($width / $max_width) ? $height / $max_height : $width / $max_width;
$thumbnailheight = sprintf ("%.0f",$height / $relation);
$thumbnailwidth = sprintf ("%.0f",$width / $relation);
$big = GD::Image->newFromJpeg("/usr/local/httpd/htdocs/thumbs/$_");
$lit = new GD::Image($thumbnailwidth,$thumbnailheight);
$lit->copyResized($big, 0, 0, 0, 0, $thumbnailwidth, $thumbnailheight, $width, $height);
my $jpeg_data = $lit->jpeg;
open (OUTFILE,">/usr/local/httpd/htdocs/thumbs/$_");
print OUTFILE $jpeg_data;
close OUTFILE;
}
}