Hello,
I had a few questions in regard to editing images in php, using the imagecreatefromjpeg() function, and the memory_limit setting
1. If I want to resize an image, must I call imagecreatefromjpeg() to get the image resource, then call imagecopyresampled/imagecopyresized to scale the image? Is this the only way?
2. I've noticed w/ images that are high in resolution, imagecreatefromjpeg() will require a lot of memory. For example, I have an image thats 500K and 3072x2304 that requres ~40mb of memory to load.
So, is using imagecreatefromjpeg() inefficient? Is there an alternative approach to getting the raw data for an image...specifically for resizing or cropping an image?
3. To get around from php throwing a fatal error complaining about not having enough memory to complete the imagecreatefromjpeg() operation, I must ensure that the memory_limit setting is set to a high enough value. What is a good value for this setting? I currently have it set at 20meg and I have logic that attempts to calculate the memory required to perform the imagecreatefromjpeg() call and increase the memory limit if it needs to.
image editing, imagecreatefromjpeg(), and memory_limit
Moderator: General Moderators
-
mechamecha
- Forum Commoner
- Posts: 32
- Joined: Thu May 31, 2007 8:49 pm