IchBin Posted February 17, 2009 Share Posted February 17, 2009 So I'm writing an upload script for images. Once the image is uploaded and copied to a directory, it then resizes the image and makes it less than 500px wide/tall. After getting the code to actually run for the first time it gave me an out of memory error. I found this gem after reading up on imagecreatefromjpeg on the PHP site. $imageInfo = GetImageSize($imageFilename); $memoryNeeded = Round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + Pow(2, 16)) * 1.65); It calculates the amount of memory needed for creating an image-resource out of and image-file. According to this code I need just over 30MB. The image that I uploaded is 1.5MB. Is this right? I mean seriously, 30+MB to process a single image of 1.5MB? I know that other scripts do this with half that, and probably even less. How can I figure out what is using up the memory? I'm basically doing the process the same way this guy wrote his class. http://us.php.net/manual/en/function.imagecopyresampled.php#85929 Any thoughts? Thanks! Link to comment https://forums.phpfreaks.com/topic/145584-memory_limit-question/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.