\n";
print (("この画像のサイズを変更します。","Resizing the following image.")[$lang]);
print "
\n";
print qq(
\n";
print qq();
print qq();
print qq(\n);
&htmltail;
}
sub resize {
my $i;
my $target_type = $in{target_type};
if ($target_type ne 'xy_pixel' and
$target_type ne 'xy_ratio' and
$target_type ne 'area_ratio'){
&error((('変換方法を選択してください。','Please select conversion type')[$lang]));
}
&htmlhead($title);
print "
";
print (("保存は画像をクリックして別ウィンドウで保存するか、右クリックでメニューから保存してください。","Please save photo with right click on a image, or simply click the image and do it on a separate window.")[$lang]);
print "
\n";
print (("サーバー上に変換後の画像ファイルが作成されているので個別に消す場合は「このファイルをサーバーから削除する」をクリックしてください。またまとめて全部消す場合はこのページ一番下にある「変換後の全ての画像をサーバ上から削除する」をクリックしてください。変換後のファイル名を覚えていれば後から$script?mode=delete_image&images=filename,filename,...で削除できます。ここで削除しなくてもファイルは一定時間後に自動的に削除されます。","The converted files are generated in the server. If you want to delete them from the server individually, please click \"Delete this file on the server\". If you want to delete all of them at once, please click \"Delete all converted files from the server\" link. If you remember file names, you can delete the files by $script?mode=delete_image&images=filename,filename,.... The files will be deleted automatically some time later.")[$lang]);
print "
\n";
print (("まとめてアーカイブされた.zipでダウンロードする場合は、画像を削除する前にこのページ一番下の「まとめてzip fileでダウンロードする」をクリックしてください。","If you want to download with a .zip file, please click \"Download as a zip file\" in the bottom of this page before deleting the images.")[$lang]);
print " \n";
&backbutton;
print "
";
my @new_imagefiles;
foreach my $imagefile (split /,/, $in{filename}) {
my $image = basename($imagefile);
$image =~ s/^.+[\/\\]([^\/\\]+)$/$1/; #just in case
my ($body,$path,$suffix) = fileparse("$image",'\.\w+');
my ($im, $width, $height) = &openimage($imagefile);
my ($new_width, $new_height);
if ($target_type eq 'xy_pixel'){
($new_width, $new_height) = (int($in{target_pw}), int($in{target_ph}));
} elsif ($target_type eq 'xy_ratio'){
($new_width, $new_height) = (int($width*$in{target_rw}/100), int($height*$in{target_rh}/100));
} elsif ($target_type eq 'area_ratio'){
($new_width, $new_height) = (int($width*sqrt($in{target_rarea}/100)), int($height*sqrt($in{target_rarea}/100)));
} else {
print (("無効なサイズ選択です。","Invalid size selectoin")[$lang]);
exit;
}
my $new_image_body = lc($body) . "_${new_width}x${new_height}" . lc($suffix);
my $new_image = "$tmpdir/$new_image_body";
push(@new_imagefiles,$new_image_body);
my $target_im = new GD::Image($new_width,$new_height,1);
$target_im->copyResized($im,0,0,0,0,$new_width,$new_height,
$width,$height);
unless (open(IMAGE, "> $new_image")){
print (("テンポラリファイル作成に失敗しました。",'Failed to create a temporary file')[$lang]);
exit;
}
binmode(IMAGE);
if ($suffix =~ /\.jpe?g$/i){
print IMAGE $target_im->jpeg(80);
} elsif ($suffix =~ /\.gif$/i) {
print IMAGE $target_im->gif();
} elsif ($suffix =~ /\.png$/i) {
print IMAGE $target_im->png();
} elsif ($suffix =~ /\.gd$/i) {
print IMAGE $target_im->gd();
} elsif ($suffix =~ /\.gd2$/i) {
print IMAGE $target_im->gd2();
}
close(IMAGE);
chmod (0666,$new_image);
print "
\n";
print "$new_image_body \n";
print "width=$new_width, height=$new_height \n";
my $dellink_mes = ("このファイルをサーバーから削除する","Delete this image file from the server")[$lang];
print qq($dellink_mes \n);
print qq(
\n);
print "
\n";
}
my $new_imagefiles = join ",", @new_imagefiles;
my $delmes = ("変換後の全ての画像をサーバ上から削除する","Delete all converted images from server")[$lang];
print "