Вот что имеем:
if ($file_type != "image/x-png" and $file_type != "image/pjpeg") out ("Выберете другой формат рисунка (jpg или png)");
$file1_name = $file_name;
for ($n=1; $n>0; $n++) {
if (!file_exists ("data/scrin/{$file1_name}")) {
$file_name = $file1_name;
break;
}
$file1_name = $n.$file_name;
}
$ar = getimagesize ($file);
$x = $ar[0];
$y = $ar[1];
$new_file = "s".$file_name;
if ($file_type == "image/x-png") $im = imagecreatefrompng ($file);
if ($file_type == "image/pjpeg") $im = imagecreatefromjpeg ($file);
$im_n = imagecreate ("128", "96");
$result = imagecopyresized ($im_n, $im, $x, $y, $x, $y, "128", "96", $x, $y);
if (!$result) out ("Невозможно уменьшить рисунок");
if ($file_type == "image/x-png") {
if (!imagepng ($im, "data/scrin/{$file_name}")) out ("Error");
if (!imagepng ($im_n, "data/scrin/{$new_file}")) out ("Error");
}
if ($file_type == "image/pjpeg") {
if (!imagejpeg ($im, "data/scrin/{$file_name}")) out ("Error");
if (!imagejpeg ($im_n, "data/scrin/{$new_file}")) out ("Error");
}
Как imagecopyresized() использовать? мне надо уменьшить рисунок $im (дескриптор) размером $x и $y -> в $im_n размером 128x96