#!/usr/bin/perl use CGI; use Image::Magick; my $cgi = new CGI; my $fname = $cgi->param('fname'); my $thumbname = $cgi->param('thumbname'); sub make_thumbnail_v2{ # receives: # file source (absolute path on machine) # file target out (absolute path on machine) # restriction # restriction type # quality my ($src,$out,$res,$restrict_type,$quality)=@_; my $t; # $restrict_type can be: # both restrict to height and width :both won't go over this.. # width restrict to width # height restrict to height # square square - will crop sides or top and bottom to fit. neat. my $img = Image::Magick->new; #blank $img->Read($src); #read source file into blank my ($w,$h) = $img->Get('width','height'); # find dimensions # # # $t = $w ."|" . $h ."\n"; #if width is bigger then height, we use restrict to w if ($restrict_type eq 'both'){ $restrict_type = $w>$h ? 'width':'height'; } my $newh=$res; my $neww=$res; # initialize new dimensions if ($restrict_type eq 'height') { $neww=(($w*$res)/$h); } if ($restrict_type eq 'width') { $newh=(($h*$res)/$w); } # different formula for square if ($restrict_type eq 'square'){ my ($cut,$xcut,$ycut); if ($w>$h){ $cut=$h; $xcut=(($w-$h)/2); $ycut=0; } if ($w<$h){ $cut=$w; $xcut=0; $ycut=(($h-$w)/2); } $img->Crop(width=>$cut,height=>$cut,x=>$xcut,y=>$ycut); $img->Resize(width=>$res, height=>$res); # } else { $img->Resize(width=>$neww, height=>$newh); } $img->Set(quality=>$quality); $img->Write($out); undef $img; return($t); } my $y; if (length($fname) == 0) { } else { $y = make_thumbnail_v2($prefix.$fname, $prefix.$thumbname, 200, 'both', 65); } open(DEBUG, ">/tmp/silly") || print "ERROR"; print DEBUG "$prefix$fname => $prefix$thumbname"; close(DEBUG); print STDOUT "Content-Type: text/html\n"; print STDOUT "Content-Disposition: inline\n\n"; #print STDOUT $y; #!/usr/bin/perl use CGI; use Image::Magick; my $cgi = new CGI; my $fname = $cgi->param('fname'); my $thumbname = $cgi->param('thumbname'); sub make_thumbnail_v2{ # receives: # file source (absolute path on machine) # file target out (absolute path on machine) # restriction # restriction type # quality my ($src,$out,$res,$restrict_type,$quality)=@_; my $t; # $restrict_type can be: # both restrict to height and width :both won't go over this.. # width restrict to width # height restrict to height # square square - will crop sides or top and bottom to fit. neat. my $img = Image::Magick->new; #blank $img->Read($src); #read source file into blank my ($w,$h) = $img->Get('width','height'); # find dimensions # # # $t = $w ."|" . $h ."\n"; #if width is bigger then height, we use restrict to w if ($restrict_type eq 'both'){ $restrict_type = $w>$h ? 'width':'height'; } my $newh=$res; my $neww=$res; # initialize new dimensions if ($restrict_type eq 'height') { $neww=(($w*$res)/$h); } if ($restrict_type eq 'width') { $newh=(($h*$res)/$w); } # different formula for square if ($restrict_type eq 'square'){ my ($cut,$xcut,$ycut); if ($w>$h){ $cut=$h; $xcut=(($w-$h)/2); $ycut=0; } if ($w<$h){ $cut=$w; $xcut=0; $ycut=(($h-$w)/2); } $img->Crop(width=>$cut,height=>$cut,x=>$xcut,y=>$ycut); $img->Resize(width=>$res, height=>$res); # } else { $img->Resize(width=>$neww, height=>$newh); } $img->Set(quality=>$quality); $img->Write($out); undef $img; return($t); } my $y; if (length($fname) == 0) { } else { $y = make_thumbnail_v2($prefix.$fname, $prefix.$thumbname, 200, 'both', 65); } open(DEBUG, ">/tmp/silly") || print "ERROR"; print DEBUG "$prefix$fname => $prefix$thumbname"; close(DEBUG); print STDOUT "Content-Type: text/html\n"; print STDOUT "Content-Disposition: inline\n\n"; #print STDOUT $y; #!/usr/bin/perl use CGI; use Image::Magick; my $cgi = new CGI; my $fname = $cgi->param('fname'); my $thumbname = $cgi->param('thumbname'); sub make_thumbnail_v2{ # receives: # file source (absolute path on machine) # file target out (absolute path on machine) # restriction # restriction type # quality my ($src,$out,$res,$restrict_type,$quality)=@_; my $t; # $restrict_type can be: # both restrict to height and width :both won't go over this.. # width restrict to width # height restrict to height # square square - will crop sides or top and bottom to fit. neat. my $img = Image::Magick->new; #blank $img->Read($src); #read source file into blank my ($w,$h) = $img->Get('width','height'); # find dimensions # # # $t = $w ."|" . $h ."\n"; #if width is bigger then height, we use restrict to w if ($restrict_type eq 'both'){ $restrict_type = $w>$h ? 'width':'height'; } my $newh=$res; my $neww=$res; # initialize new dimensions if ($restrict_type eq 'height') { $neww=(($w*$res)/$h); } if ($restrict_type eq 'width') { $newh=(($h*$res)/$w); } # different formula for square if ($restrict_type eq 'square'){ my ($cut,$xcut,$ycut); if ($w>$h){ $cut=$h; $xcut=(($w-$h)/2); $ycut=0; } if ($w<$h){ $cut=$w; $xcut=0; $ycut=(($h-$w)/2); } $img->Crop(width=>$cut,height=>$cut,x=>$xcut,y=>$ycut); $img->Resize(width=>$res, height=>$res); # } else { $img->Resize(width=>$neww, height=>$newh); } $img->Set(quality=>$quality); $img->Write($out); undef $img; return($t); } my $y; if (length($fname) == 0) { } else { $y = make_thumbnail_v2($prefix.$fname, $prefix.$thumbname, 200, 'both', 65); } open(DEBUG, ">/tmp/silly") || print "ERROR"; print DEBUG "$prefix$fname => $prefix$thumbname"; close(DEBUG); print STDOUT "Content-Type: text/html\n"; print STDOUT "Content-Disposition: inline\n\n"; #print STDOUT $y; #!/usr/bin/perl use CGI; use Image::Magick; my $cgi = new CGI; my $fname = $cgi->param('fname'); my $thumbname = $cgi->param('thumbname'); sub make_thumbnail_v2{ # receives: # file source (absolute path on machine) # file target out (absolute path on machine) # restriction # restriction type # quality my ($src,$out,$res,$restrict_type,$quality)=@_; my $t; # $restrict_type can be: # both restrict to height and width :both won't go over this.. # width restrict to width # height restrict to height # square square - will crop sides or top and bottom to fit. neat. my $img = Image::Magick->new; #blank $img->Read($src); #read source file into blank my ($w,$h) = $img->Get('width','height'); # find dimensions # # # $t = $w ."|" . $h ."\n"; #if width is bigger then height, we use restrict to w if ($restrict_type eq 'both'){ $restrict_type = $w>$h ? 'width':'height'; } my $newh=$res; my $neww=$res; # initialize new dimensions if ($restrict_type eq 'height') { $neww=(($w*$res)/$h); } if ($restrict_type eq 'width') { $newh=(($h*$res)/$w); } # different formula for square if ($restrict_type eq 'square'){ my ($cut,$xcut,$ycut); if ($w>$h){ $cut=$h; $xcut=(($w-$h)/2); $ycut=0; } if ($w<$h){ $cut=$w; $xcut=0; $ycut=(($h-$w)/2); } $img->Crop(width=>$cut,height=>$cut,x=>$xcut,y=>$ycut); $img->Resize(width=>$res, height=>$res); # } else { $img->Resize(width=>$neww, height=>$newh); } $img->Set(quality=>$quality); $img->Write($out); undef $img; return($t); } my $y; if (length($fname) == 0) { } else { $y = make_thumbnail_v2($prefix.$fname, $prefix.$thumbname, 200, 'both', 65); } open(DEBUG, ">/tmp/silly") || print "ERROR"; print DEBUG "$prefix$fname => $prefix$thumbname"; close(DEBUG); print STDOUT "Content-Type: text/html\n"; print STDOUT "Content-Disposition: inline\n\n"; #print STDOUT $y; #!/usr/bin/perl use CGI; use Image::Magick; my $cgi = new CGI; my $fname = $cgi->param('fname'); my $thumbname = $cgi->param('thumbname'); sub make_thumbnail_v2{ # receives: # file source (absolute path on machine) # file target out (absolute path on machine) # restriction # restriction type # quality my ($src,$out,$res,$restrict_type,$quality)=@_; my $t; # $restrict_type can be: # both restrict to height and width :both won't go over this.. # width restrict to width # height restrict to height # square square - will crop sides or top and bottom to fit. neat. my $img = Image::Magick->new; #blank $img->Read($src); #read source file into blank my ($w,$h) = $img->Get('width','height'); # find dimensions # # # $t = $w ."|" . $h ."\n"; #if width is bigger then height, we use restrict to w if ($restrict_type eq 'both'){ $restrict_type = $w>$h ? 'width':'height'; } my $newh=$res; my $neww=$res; # initialize new dimensions if ($restrict_type eq 'height') { $neww=(($w*$res)/$h); } if ($restrict_type eq 'width') { $newh=(($h*$res)/$w); } # different formula for square if ($restrict_type eq 'square'){ my ($cut,$xcut,$ycut); if ($w>$h){ $cut=$h; $xcut=(($w-$h)/2); $ycut=0; } if ($w<$h){ $cut=$w; $xcut=0; $ycut=(($h-$w)/2); } $img->Crop(width=>$cut,height=>$cut,x=>$xcut,y=>$ycut); $img->Resize(width=>$res, height=>$res); # } else { $img->Resize(width=>$neww, height=>$newh); } $img->Set(quality=>$quality); $img->Write($out); undef $img; return($t); } my $y; if (length($fname) == 0) { } else { $y = make_thumbnail_v2($prefix.$fname, $prefix.$thumbname, 200, 'both', 65); } open(DEBUG, ">/tmp/silly") || print "ERROR"; print DEBUG "$prefix$fname => $prefix$thumbname"; close(DEBUG); print STDOUT "Content-Type: text/html\n"; print STDOUT "Content-Disposition: inline\n\n"; #print STDOUT $y;


tailgate1.jpg


tailgate2.jpg


tailgate3.jpg


tailgate4.jpg


tailgate5.jpg