phpknight Posted November 22, 2007 Share Posted November 22, 2007 I am running a script where I upload large images. I get the peak memory before and after each time I use it. To create the image I use: $image=imagecreatefrompng($_FILES['theFiles']['tmp_name'][$fileNumber]); What is weird is that 4500x4500 png works fine and doesn't come close to the 400MB limit for the script, but for sme reason 4499x4499 fails and so does 4501x4501. Other lower sizes fail as well, but 2999x2999 works. Any idea what might be going on here? I can't really believe that the script is out of memory. Even the errors say Out of memory (allocated 104,595,456) (tried to allocate 80,964,004 bytes) . But both those numbers are well below the limit. I tried to figure out if a certain PNG of max dimensions X x Y caused it, but it like I said 4500 works but 4499 doesn't. PHP version is 5.2.3. Any ideas? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 22, 2007 Share Posted November 22, 2007 Post your script please. Quote Link to comment Share on other sites More sharing options...
phpknight Posted November 22, 2007 Author Share Posted November 22, 2007 I am trying to create a test script which isolates the issue that I can post up here. I'll post it as soon as I am done. Quote Link to comment Share on other sites More sharing options...
phpknight Posted November 23, 2007 Author Share Posted November 23, 2007 Okay, I may have solved the problem but do not know why. I am on a dedicated box. If I set the memory limit in the ini file itself AND the script, all the files uploads seem to work. But if I only set the INI or only the script (even with the corrected ini file), then the above files do not work. Any ideas? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted November 23, 2007 Share Posted November 23, 2007 It is likely that the syntax being used to set them is not correct. Post actual examples. It is also possible that the php.ini that you are making changes to is not the one that php is using. The memory limit being set in the script would override any setting in php.ini, assuming the syntax is correct. Quote Link to comment Share on other sites More sharing options...
phpknight Posted November 23, 2007 Author Share Posted November 23, 2007 I'm going to mark this one as solved, but please reply if you have an idea. After more exploration, I realized that if I set the memory limit in the script way over the ini, the script does not always work probably even though outputting the result shows that the ini value does get changed. However, if I set the ini high, I can limit the scripts just fine by putting a lower number, and the scripts halt as expected at the lower levels. Quote Link to comment Share on other sites More sharing options...
wsantos Posted November 23, 2007 Share Posted November 23, 2007 Out of curiousity...have anyone tried this on different versions? Quote Link to comment 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.