|< 1 2 3 >| | 28 Einträge, 3 Seiten |
1
2
3
Corrupt JPEG data: 2385 extraneous bytes before marker 0x51
gd-jpeg: JPEG library reports unrecoverable error: Unsupported marker type 0x51
source is not of type GD::Image at thumbs.pl line 29.
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
#!/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"))
{
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;
}
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;
}
}
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
use strict;
use GD;
use Image::Size;
use IO::File;
use IO::Dir;
use constant MAX_WIDTH => 80;
use constant MAX_HEIGHT => 80;
use constant IMAGEPATH => "/usr/local/httpd/htdocs/thumbs/";
resize_images(IMAGEPATH, ".jpg", MAX_WIDTH, MAX_HEIGHT);
sub resize_images
{
my ($folder, $ext, $maxwidth, $maxheight) = @_;
my $dir = new IO::Dir;
if($dir->open($folder))
{
while(defined(my $filename = $dir->read))
{
my $file = "$folder/$filename";
next if $file =~ /^\.\.?$/;
next if -d $file;
next if $file !~ /$ext$/io;
eval
{
my ($width, $height) = imgsize($file);
my $relation = ($height / $max_height) > ($width / $max_width) ? $height / $maxheight : $width / $maxwidth;
my $thumbnailheight = sprintf ("%.0f",$height / $relation);
my $thumbnailwidth = sprintf ("%.0f",$width / $relation);
my $big = GD::Image->newFromJpeg($file);
my $lit = new GD::Image($thumbnailwidth, $thumbnailheight);
$lit->copyResized($big, 0, 0, 0, 0, $thumbnailwidth, $thumbnailheight, $width, $height);
my $fh = new IO::File;
if($fh->open("> $file))
{
print $fh $lit->jpeg;
$fh->close();
}
undef $lit;
undef $big;
}
}
$dir->close();
}
}
|< 1 2 3 >| | 28 Einträge, 3 Seiten |