steviez Posted November 1, 2009 Share Posted November 1, 2009 Hi, I am trying to upload and resize an image on my server but i am getting an out of memory error. My php limit is 64M so i dont see why it wont work. My Code: <?php case "jpg": $file = imagecreatetruecolor($width, $height); $new = imagecreatefromjpeg($this->file_tempname); for($i=0; $i<256; $i++) { imagecolorallocate($file, $i, $i, $i); } imagecopyresampled($file, $new, 0, 0, 0, 0, $width, $height, $this->file_width, $this->file_height); imagejpeg($file, $photo_dest, 60); imagedestroy($new); imagedestroy($file); break; ?> any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/ Share on other sites More sharing options...
Alex Posted November 1, 2009 Share Posted November 1, 2009 Why are you doing this? for($i=0; $i<256; $i++) { imagecolorallocate($file, $i, $i, $i); } There's no purpose for that at all.. Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/#findComment-948808 Share on other sites More sharing options...
steviez Posted November 1, 2009 Author Share Posted November 1, 2009 Why are you doing this? for($i=0; $i<256; $i++) { imagecolorallocate($file, $i, $i, $i); } There's no purpose for that at all.. It was in the code for my script Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/#findComment-948810 Share on other sites More sharing options...
Alex Posted November 1, 2009 Share Posted November 1, 2009 Yea, I can see it's there.. But why? Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/#findComment-948812 Share on other sites More sharing options...
steviez Posted November 1, 2009 Author Share Posted November 1, 2009 Yea, I can see it's there.. But why? No i ment it was there when i bought the script, no idea why Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/#findComment-948813 Share on other sites More sharing options...
steviez Posted November 3, 2009 Author Share Posted November 3, 2009 I know now that it is a memory issue because of shared hosting and it taking a lot of memory to do... So my question is this: is there a better way to do it on shared hosting? Quote Link to comment https://forums.phpfreaks.com/topic/179856-fatal-error-out-of-memory/#findComment-950129 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.