Author Topic: Thumnail error  (Read 9875 times)

0 Members and 1 Guest are viewing this topic.

Offline raghunadhreddys

  • Newbie
  • *
  • Posts: 46
    • View Profile
Thumnail error
« on: May 10, 2010, 12:35:53 PM »
i am getting the error in my c panel while auto thumbnaling .the error is

"Allowed memory size of 18874368 bytes exhausted (tried to allocate 10240 bytes)"

what is this?

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: Thumnail error
« Reply #1 on: May 10, 2010, 02:46:39 PM »
hmm,, are u on a shared server ? or in a free server  :?: its a host error ;(

This error indicates that there is not enough memory allowed per script.
Usually this occur when processing images (resizing, creating thumbnails)

Your only solutions are:

1) create thumbnails manually and upload them with the image (or add them later) (same applied to image resizing)
2) try use ImageMagic or NetPBM instead of GD (for information about executable paths contact your host's administrator)
3) ask your server's administrator increase memory limit (good luck on this one)
4) find another host.

Source - V@NO

Some Extra Solution

This little Addon worked for me. Maybe it can help you.

put these lines in global.php and /includes/image_utils.php direct after <?php


Code: [Select]
ini_set("memory_limit", "150M");
ini_set("max_execution_time", "10000");
ini_set("default_socket_timeout", "100");
ini_set("expect.timeout", "360");
ini_set("upload_max_filesize", "134217728");
ini_set("post_max_size", "134217728");

and edit ur ..htaccess and put the following code to it

Code: [Select]
<FilesMatch "\.(php|html?)$">
php_value upload_max_filesize 500M
php_value post_max_size 500M
</FilesMatch>

sometimes it may work. this is what i did when i got this error, 1nce when i was on a shared host .. this worked pretty well ;)
Have A Nice Day !
I'm Back :)

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Thumnail error
« Reply #2 on: July 05, 2010, 11:58:43 PM »

I read on another post...
http://www.4homepages.de/forum/index.php?topic=24179.0
that PHP5 needs 6x more memory to create thumbnails?
I thought PHP5 was a step up  :( Does that mean the thumbnail routines in 4images need to be optimized for php5 or is this internal on the php5?

My provider only gives me 20meg. I have seen the above error 2times now in the error log.
My users are the ones uploading and they do not create thumbnails on their computers, that would be too much trouble...
The files that they are uploading are only 800k in size, what does PHP5 need with 50megs of memory to make them smaller?

This could be a big problem, do you know if either of the other 2 graphic libraries handle the memory better in PHP5?
I can ask my provider if they can install one of them but I would prefer knowing which one will work better under the PHP5 environment.
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumnail error
« Reply #3 on: July 06, 2010, 03:15:17 AM »
the compressed to 800k jpg image is about 3+ mb in uncompressed format (BMP for example)

What I did was add at the beginning and at the end of resize_image_gd() function in image_utils.php:
echo memory_get_peak_usage(true) . "<br>";
Then uploaded an image via members upload form.
It showed two numbers that represent the maximum memory usage before GD was executed and after.

Here is some results PHP v5.3.1 (the numbers in "before"/"after" - is php memory usage and numbers in "GD usage" is the difference between "before" and "after"):

Image 1:      820851 B [801  KB] as JPG (3686454 B [3.6MB] as BMP) 1280x960
before:       524288 B [512  KB]
after:       6553600 B [6.4  MB]
GD usage:    6029312 B [5.9  MB]


Image 2:     4695063 B [4.6  MB] as JPG (36000054 B [35.1MB] as BMP) 4000x3000
before:       524288 B [512  KB]
after:      61079552 B [59.6 MB]
GD usage:   60555264 B [59.1 MB]


Image 3:      364458 B [356  KB] as JPG (36000054 B [35.1MB] as BMP) 4000x3000 (same image as #2, only compressed to maximum, lowest quality)
before:       524288 B [512  KB]
after:      61079552 B [59.6 MB]
GD usage:   60555264 B [59.1 MB]

These results are only for creating thumbnails, images themselves weren't resized.
Unfortunately memory_get_peak() and memory_get_peak_usage() functions are not available in PHP4 (at least I couldn't find version compiled with required --enable-memory-limit). No tests were done with PHP4 :(

It is interesting to see that the maximum memory usage is double of the filesize if convert image into BMP.

But most importantly this test proves: filesize doesn't matter. What matters is the image dimensions.

Perhaps you should consider use IM or NetPBM instead of GD, as to these tools php memory limit is not applied.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Rembrandt

  • Guest
Re: Thumnail error
« Reply #4 on: July 06, 2010, 05:31:16 AM »
...
The files that they are uploading are only 800k in size, what does PHP5 need with 50megs of memory to make them smaller?....
the problem is not the image size, but the image resolution.
limits the image resolution in ACP/General/settings/Upload settings (Max. image width in pixel) and (Max. image heigth in pixel) e.g. 800x600 or 1024x768

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Thumnail error
« Reply #5 on: July 06, 2010, 12:09:11 PM »
Thanks for the comparison on filesizes,
I forgot about jpg compression.
After googling around last night I found out that other gallery scripts are running into the same problems.
I bumped up my dimensions on my site to 2000X2000 to keep up with other sites. People do not want the smaller pics anymore, not when there are 10meg+ cameras out there. I did that about 1 week before I moved to PHP5 so maybe I just did not know about the memory usage till now...

Will have to rethink a few things and maybe talk with my provider. It looks like my site is in the 50meg memory usage area based on V@nos testing.

Thanks for your input!
Buddy Duke
www.budduke.com

Offline V@nо

  • Addicted member
  • ******
  • Posts: 1.223
    • View Profile
Re: Thumnail error
« Reply #6 on: July 06, 2010, 04:02:32 PM »
Did you try IM or NetPBM? IM works as good as GD...
Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.

Rembrandt

  • Guest
Re: Thumnail error
« Reply #7 on: July 06, 2010, 05:04:54 PM »
...
 I bumped up my dimensions on my site to 2000X2000 to keep up with other sites.
People do not want the smaller pics anymore, not when there are 10meg+ cameras out there. ....
I would be interested, with which Monitor they view the Pictures?

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Thumnail error
« Reply #8 on: July 06, 2010, 08:43:42 PM »
...
 I bumped up my dimensions on my site to 2000X2000 to keep up with other sites.
People do not want the smaller pics anymore, not when there are 10meg+ cameras out there. ....
I would be interested, with which Monitor they view the Pictures?

Your correct, they aren't for monitors anymore at that size. I think they are using them for reprints and stuff like that. Some of the boards I have looked at have some scanning in the 3000X4000 range. The files are large in size and great when you print them on a full color printer but for displaying on the monitor, way overkill.
Buddy Duke
www.budduke.com

Rembrandt

  • Guest
Re: Thumnail error
« Reply #9 on: July 06, 2010, 10:42:25 PM »
for prints..,ok this is an argument, but for more as 2000x2000, I would take at least 128mb.

mfg Andi

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Thumnail error
« Reply #10 on: July 11, 2010, 08:28:18 PM »
Kinda on the same subject...
I backed my images down to 1600X1500 which make them about 9meg when they get opened in the GD library.
when I am in the admin panel and select multiple images to upload. (in this case I was doing 4 this size)
I got a white screen and a memory error on my script log.
When I uploaded them one at a time on the same page in the admin panel, they all uploaded fine.
Does the images.php script clear the memory after each thumbnail creation or does it wait till all 4 of them are created?
I have not tried ftping them and doing a check new images to see if it handles them differently...
just curious if there is a memory leak in that part of the script or if this is normal...
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumnail error
« Reply #11 on: July 11, 2010, 11:00:23 PM »
When you upload images via ACP, they are not being resized, nor thumbnails created...perhaps you have other restrictions on the server, such as max upload size limit, or similar.


I just checked autothumbnailer on 4 exact same images all at once, with each image memory usage was identical, so, there is no memory leak.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: Thumnail error
« Reply #12 on: July 11, 2010, 11:30:03 PM »
@ V@no,
Oh Wow, you are right. I just looked at my test site and it is normal.
I am using your mod on my main site and forgot I was using it...
Batch copy/move/edit http://www.4homepages.de/forum/index.php?topic=6759.0
but I am pretty sure it is not the latest version, I have to start wrtiting down all the mods that I am using on my production site so I will stop making mistakes like this.

I will test it later and post the question on that mods thread if it comes up again...

Thanks for taking the time to test it, you are correct, the normal one does not do anything to the uploaded files but the Mod has the create thumbnail which saves allot of my time
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumnail error
« Reply #13 on: July 11, 2010, 11:40:40 PM »
Still, just tried that mod, same results - memory usage for each image is exactly the same.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)