in reply to Re: Resizing Uploaded Images?
in thread Resizing Uploaded Images?
#!E:\perl\bin\perl.exe -w
use CGI qw(:standard);
$savedir = "E:\\network\\apache2\\htdocs";
$query = new CGI;
use GD;
if ($file=param('filename')) {
save_file();
} else {
show_form();
}
sub show_form {
print $query->header();
print $query->start_html("File Uploading"),
h1('File uploading'),
$query->start_multipart_form(),
p,
"The file to upload:",
p,
$query->filefield(-name=>'filename',
-size=>45),
p,
$query->submit(-name=>'submit',
-value=>'Upload File'),
$query->endform,
$query->end_html;
}
sub save_file {
$file2 = upload('filename');
$im = new GD::Image($file2);
$rim = new GD::Image(240,240);
($width,$height) = $im->getBounds();
$rim->copyResized($im,0,0,0,0,$width,$height,240,240);
#close FILE;
# print "Content-type: image/png\n\n";
print "Content-type: text/html\n\n";
# binmode STDOUT;
print "$width $height";
# print $rim->png;
}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Resizing Uploaded Images?
by cirisme (Initiate) on Jun 11, 2003 at 13:54 UTC |