#!/usr/bin/perl
print "Content-type: text/html\n\n";
use Imager;
use warnings;
use strict;
use CGI::Carp qw(fatalsToBrowser);
my $img = Imager->new();
$img->read(file=>"../Uploaded_image.tif") or die $img->errstr;
my $imgfull = Imager->new();
my $imgfull = $img->scale(xpixels => 500); # 400x285
$imgfull->write(file=>"../Uploaded_image.jpg", type=>"jpeg")
or die "Cannot write: ", $imgfull->errstr;
my $imgthum = Imager->new();
my $imgthum = $img->scale(xpixels => 100); # 400x285
$imgthum->write(file=>"../Uploaded_image_thumb.jpg", type=>"jpeg")
or die "Cannot write: ", $imgthum->errstr;