Issue:
- Your hosting provider offers you service with only a 64Mb memory limit.
- Your image upload has a larger than 64Mb memory usage as uncompressed raw pixel data.
Solutions:
1) Increase your memory limit in PHP.ini file, typically with :
memory_limit = 128M
2) Increase your memory limit on your page only, editing the php.ini
only for that page execution :
ini_set('memory_limit','128M');
3) Limit the size of the original file upload.
there are a few ways to do this, so please read the PHP manual as well as reaseach some useful posts found via Google Searching.
4) You can also try and resize the image before uploading.
From your statement that you cant edit the PHP.ini with ini_set
then it looks like you should use option 4 and 3.
Also, your current code is incorrect.
imagejpeg($image, '../../uploads/DSC_0230.jpg.new', 0.8);
The compression value should be an integer between 0 and 100. to correctly set the saved JPEG to a proper compression level:
imagejpeg($image, '../../uploads/DSC_0230.jpg.new', 80);
This will save the image to a value of 80 compression(the value it looks like you're attempting with 0.8
).