fomalhaut
Member
- Messages
- 107
- Reaction score
- 0
- Points
- 16
Hello.
I'm trying to resize a client image before insert it into my web site. The image is choosen on the client post throught a form, and is correctly obtained. It's accessible by $_FILES['fileNameAIns'] array.
the last messages I find on the page is :
Line 82 is the imagecreatefromjpeg function.
Could someone show me where I'm wrong please ?
Just a precision : on the disk of client machine, the image size is 3,05 Mo.
I'm trying to resize a client image before insert it into my web site. The image is choosen on the client post throught a form, and is correctly obtained. It's accessible by $_FILES['fileNameAIns'] array.
PHP:
$max_cote = 1600;
list($wOri, $hOri) = getimagesize($_FILES['fileNameAIns']['tmp_name']);
$ratio = $wOri / $hOri;
if ($wOri > $hOri) {
$modWidth = $max_cote;
$modHeight = $max_cote / $ratio;
}
else {
$modHeight = $max_cote;
$modWidth = $max_cote * $ratio;
}
$tn = imagecreatetruecolor($modWidth, $modHeight);
$imageOri = $_FILES['fileNameAIns']['tmp_name'];
echo '<br />before imagecreatefromjpeg:'.$imageOri;
$image = imagecreatefromjpeg($imageOri);
echo '<br />before imagecopyresampled';
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modWidth, $modHeight, $wOri, $hOri);
echo '<br />before imagejpeg';
imagejpeg($tn);
Code:
<br />before imagecreatefromjpeg:C:\xampp\tmp\php1624.tmp<br />
<b>Fatal error</b>: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3072 bytes) in <b>C:\xampp\htdocs\jardin\inc\gesJardin.inc</b> on line <b>82</b><br />
Could someone show me where I'm wrong please ?
Just a precision : on the disk of client machine, the image size is 3,05 Mo.
Last edited: