Jump to content

8MB Allocated Memory Used????


onlyican

Recommended Posts

Hey people

I dont understand this

I created a class to upload / manipulate images.

I have just been informed of the following error
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 3072 bytes) in /home/httpd/vhosts/****.co.uk/httpdocs/administration/includes/class.uploadimg.php on line 360

Now I can not see my class exceeding the 8MB limit
Line 360 is
$image = imagecreatefromjpeg($_FILES[$this->form_file_name]["tmp_name"]);

The class can be found at

http://onlyican.com/class.uploadimg.phps

There is an Image Upload Max Size set to 1MB

I know I can set the Memory Limit higher, but I want to know WHY I am getting this message.
Link to comment
https://forums.phpfreaks.com/topic/36178-8mb-allocated-memory-used/
Share on other sites

[quote author=onlyican link=topic=124534.msg516057#msg516057 date=1170079144]
I know I can set the Memory Limit higher, but I want to know WHY I am getting this message.
[/quote]

The GD library uses a lot of memory.

I included a link in a [url=http://www.phpfreaks.com/forums/index.php/topic,121661.msg500680.html#msg500680]previous post[/url] that details this.

Regards
Huggie
something confusing me, the person has just emailed me the picture he is using.

Its 3072px Wide BY 2048px High
300DPI
but only 768kb

so what I think is happening is that when I resize the image, it still uses the 300 dpi size, which is making the file size larger, as it should be.

Is there a way in PHP, to check the DPI, and change it to 72dpi
[quote author=onlyican link=topic=124534.msg516096#msg516096 date=1170081728]
Its 3072px Wide BY 2048px High
300DPI
but only 768kb
[/quote]

The quality of that must be extremely poor!

As for setting the quality to 72dpi, I'd suggest looking through all the [url=http://uk.php.net/manual/en/ref.image.php]image functions[/url].

Huggie

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.