Jump to content

[SOLVED] Memory Problem


snivek

Recommended Posts

I am getting an out of memory error when I call imagecreatefromjpeg().  I am providing it with a 1MB image.  Per my php.ini i have 20MB allocated to me.  Does this function use a lot more memory than I think?  Are there any PHP function I can use to get the amount of memory a variable or array is using?  Like $memused = Mem($string);  Thanks!
Link to comment
Share on other sites

You can use ini_set to temporarily raise the memory limit - I've found whenever I have these problems, there's something more behind it - I was getting one yesterday and after a half hour of messing with it I found my infinite loop. You might wanna double check for that sort of thing.
Link to comment
Share on other sites

Yes, you're underestimating how much memory it uses...  Increase the memory to something like 50MB using ini_set() as suggested by Jesi.

Take a look [url=http://www.libgd.org/FAQ_PHP#Why_does_gd_cause_my_PHP_script_to_run_out_of_memory.3F]here[/url]

[code]<?php
// Increase available memory
ini_set("memory_limit","50M");
?>[/code]

Regards
Huggie
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.