I have a little problem with my website.
People use this page to create a post on my site, you can attach photos to it. All photos were working ecept that one. ( see below for the link )
When I try to upload it on the "post" page it says:
My girlfriend is the one that is trying to upload it , before uploading it she rotate the picture with windows 7 ( in preview mode ) so the image would be on the right side.
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 3411201 bytes) in /home/(rest of path)/upload.php on line 65
line 65 on upload.php = $tmp=imagecreatetruecolor($newwidth,$newheight);
I've been looking for a way to "counter" that error for 2 days.
Can anybody help me please?
It only show that error with that image, I don't know if the rotate is the problem...
Thank you very much
The problem is your script is running out of memory. Right now it seems that you have ~64mb allocated per PHP script. It is amazing that it is using more than that (unless you are uploading huge photos!), but what happens when you put the following at the top of your script?
This will raise the memory limit temporarily for that script. If you find that you need to allocate more memory for your script, then you'll have to change the value in php.ini if you don't want to use
ini_set()
.Does it work or does it run out of memory ~128mb?
NOTE:
If this is a personal project, this solution is ok. If this is something bigger than that, I would take matino's advice and limit your upload size.
Try to use smaller photo or increase your memory_limit in php.ini
In php.ini: change value of memory_limit like this: memory_limit = 258M Restart web server.