Ja potrebujem ten obrazok hned aj upravit. Napr. prvy obrazok o rozmere 800px mi urobil a pri druhom to už spadlo. Ale niekedy to urobí aj ten druhý.
Script:
Kód:
<form action="index.php" method="post" enctype="multipart/form-data">
Leták 1 <input type=file name=obr>
<input type=submit value=Odoslať>
</form>
Kód:
$mobr="pic1.jpg";
$mobr_big="pic1_big.jpg";
$cesta="../market"
$width=800;
$width=1024;
$rozmer=GetImageSize($obr);
$w1=$rozmer[0]/100;
$w2=$width/$w1;
$height=$rozmer[1]/100*$w2;
$w2_big=$width_big/$w1;
$height_big=$rozmer[1]/100*$w2_big;
$in=ImageCreateFromJpeg($obr);
if($rozmer[0]>$width):
$out=ImageCreateTruecolor($width,$height);
ImageCopyResampled($out,$in,0,0,0,0,$width,$height,$rozmer[0],$rozmer[1]);
ImageJpeg($out,"$cesta/$mobr",80)):
ImageDestroy($out);
endif;
if($rozmer[0]>$width_big):
$out_big=ImageCreateTruecolor($width_big,$height_big);
ImageCopyResampled($out_big,$in,0,0,0,0,$width_big,$height_big,$rozmer[0],$rozmer[1]);
ImageJpeg($out_big,"$cesta/$mobr_big",80);
ImageDestroy($out_big);
endif;
ImageDestroy($in);
Edit: Niekedy mi v iných scriptoch robí problém pri veľkých súboroch aj funkcia copy(), preto som to tu spomenul.
Momentálne mi ide všal o tento script.
Zdá sa že samotný upload je v poriadku, problém je pri ImageCreateTruecolor a pokiaľ sa jedná o veľký obrázok.