CODE
function checkfoto2($name)
{
$maxdim=800;
$src_img=imagecreatefromjpeg($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y)
{
if($old_x<=$maxdim) exit();
$thumb_w=$maxdim;
$thumb_h=$old_y*($maxdim/$old_x);
}
if ($old_x < $old_y)
{
if($old_y<=$maxdim) exit();
$thumb_w=$old_x*($maxdim/$old_y);
$thumb_h=$maxdim;
}
if ($old_x == $old_y)
{
if($old_x<=$maxdim) exit();
$thumb_w=$maxdim;
$thumb_h=$maxdim;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$name);
imagedestroy($dst_img);
imagedestroy($src_img);
return true;
}
{
$maxdim=800;
$src_img=imagecreatefromjpeg($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y)
{
if($old_x<=$maxdim) exit();
$thumb_w=$maxdim;
$thumb_h=$old_y*($maxdim/$old_x);
}
if ($old_x < $old_y)
{
if($old_y<=$maxdim) exit();
$thumb_w=$old_x*($maxdim/$old_y);
$thumb_h=$maxdim;
}
if ($old_x == $old_y)
{
if($old_x<=$maxdim) exit();
$thumb_w=$maxdim;
$thumb_h=$maxdim;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$name);
imagedestroy($dst_img);
imagedestroy($src_img);
return true;
}
CODE
echo "1";
checkfoto2(".".$web_upload_dir."/".$filename);
echo "2";
checkfoto2(".".$web_upload_dir."/".$filename);
echo "2";
a na wyjsciu dostaje tylko 1 i żadnych błędów - główny skypt nie przechodzi do punktu 2. Dlaczego?