Allowed memory size of bytes exhausted...

Phoca Gallery - image gallery extension
HotBunny
Phoca Member
Phoca Member
Posts: 10
Joined: 09 Apr 2010, 12:58

Allowed memory size of bytes exhausted...

Post by HotBunny »

Hi!
I use Phoca Gallery 2.6.2 and Joomla 1.5.17.

I have created a category with 26 images, all was ok.

Now I have created a category with 19 images and wanted to add one additional image,
whose size is smaller then one of the biggest of the 19 images.

Now I get the error

Fatal error: Allowed memory size of 52428800 bytes exhausted (tried to allocate 14592 bytes) in ...domain/administrator/components/com_phocagallery/libraries/phocagallery/image/imagemagic.php on line 214

From the PHP file I have seen there is a constant of 50 MB. But I am not a PHP expert.

Can anybody help me what is going on here, other posts did not address my problem.

Thanks!

HotBunny
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49198
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Allowed memory size of bytes exhausted...

Post by Jan »

Hi, search this forum for information about memory.

- check size of your images
- check your settings (memory, cpu, time)
- see the Info site in Phoca Gallery Controll Panel and test if you fit the recommended settings.


Thumbnails are created by GD library on the server, so it depends on the server which size of image can be worked.

Jan
If you find Phoca extensions useful, please support the project
HotBunny
Phoca Member
Phoca Member
Posts: 10
Joined: 09 Apr 2010, 12:58

Re: Allowed memory size of bytes exhausted...

Post by HotBunny »

Hi,

without knowing anything about PHP yet,

I deleted in imagemagic.php the code

Code: Select all

            
if ($memory < 50) {
   ini_set('memory_limit', '50M');
   $memoryLimitChanged = 1;
}
with

Code: Select all

ini_set('memory_limit', '200M');
.

And then it worked. Don't ask me why.

Moreover, when comparing the C language with PHP,
the expression

Code: Select all

    
if ($fileIn !== '' && JFile::exists($fileIn)) {

seems to be wrong, as !== does not exist, I think, you meant !=. Perhaps this also causes some problems...

What do you think?

HotBunny
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49198
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Allowed memory size of bytes exhausted...

Post by Jan »

Hi,
ini_set('memory_limit', '200M');
I think, your webhosting operator will not like you or he/she will disable the ini_set function for you :-)
seems to be wrong, as !== does not exist, I think, you meant !=. Perhaps this also causes some problems...
!== means not identical:

$a !== $b Not identical - TRUE if $a is not equal to $b, or they are not of the same type.
http://php.net/manual/en/language.opera ... arison.php

Jan
If you find Phoca extensions useful, please support the project
HotBunny
Phoca Member
Phoca Member
Posts: 10
Joined: 09 Apr 2010, 12:58

Re: Allowed memory size of bytes exhausted...

Post by HotBunny »

Jan wrote: !== means not identical:
Thanks for that information.

Meanwhile I have reverted the change.

It is still strange, that I even had no problems with even bigger file.

For me the solution is at the moment to change the constant of 50M to 200M.

So you can close this topic.

Thanks for your help.

HotBunny
luciffere
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 01 Jun 2009, 09:15

Re: Allowed memory size of bytes exhausted...

Post by luciffere »

I have same problem with Phocagallery 2.7.0 with Joomla 1.5.15

Code: Select all

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 35 bytes) in /var/www/plugins/system/plg_jamenuparams/asset/html_parser.php  on line 841
This error appear when i want to add a phoca category in menu manager.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49198
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Allowed memory size of bytes exhausted...

Post by Jan »

Did you read the answers in the forum and did you check the settings of your server and the Info panel of Phoca Gallery if all recommended settings are enabled?
If you find Phoca extensions useful, please support the project
HotBunny
Phoca Member
Phoca Member
Posts: 10
Joined: 09 Apr 2010, 12:58

Re: Allowed memory size of bytes exhausted...

Post by HotBunny »

Hi all,

regarding the "out of memory topic", I analyses the situation and had a learning effect,
which will be in my opinion helpful for all the users with the same problem.

You often say:
Jan wrote:Check size of your images...
Referring to my problem I checked the size several times. The image which caused the error message
was about 900kB. I wondered, because other images with 1100 kB did not cause the problem.
Then I finally detected was is going wrong:

When you speak about the size of the image, you mean the height, the width and the resolution
of the image. I was thinking of the physical memory the picture needs to be stored.

Example: My physical memory is about 900 kB, but the size of the image is about
3800x2800 Pixel and a resolution of 24 bit per pixel, this is finally in memory
about 30 MB which have to be handled when working with this image. The normal
user is not aware of this amount of memory...

So the solution is not to change the quality of the picture which reduced the physical
memory on disc but really the image size, which is the height and width and resolution
of the image. I have seen that the largest image used after conversion is about 640 x 480.
So my width was about 6 times bigger.

What I still wonder,
although the limit is set to 50MB in the imagemagic.php file - on server site, memory_limit
is set to 16MB - my image is about 30MB, as described. Where are the remaining 20MBs?

HotBunny
metzed
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 20 Nov 2009, 17:28

Re: Allowed memory size of bytes exhausted...

Post by metzed »

Edit (or create in your script's folder if it does not exist) the php.ini / php5.ini file with your PHP scripts (create it if it does not exist) and add the following line:
memory_limit=16M
You should replace the '16' with whatever value is appropriate.
If this does not resolve the problem, you can also increase the web server memory limit by editing (or creating in your script's folder if it does not exist) the ".htaccess" file and adding the following line:
RLimitMem 128000000

It was the RLimitMem 128000000 that solved it for me.
bogastyle
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 05 Jan 2011, 23:57
Location: Bulgaria
Contact:

Re: Allowed memory size of bytes exhausted...

Post by bogastyle »

Hi colleagues!
An acquaintance of mine had the same problem!

When He tried to upload a new photo and pressing the Image button, the popup window is blank and not showing the content of folder images/phocagallery.

Here's how we decided the problem:
1. We turned off the auto-generation of thumbnail images - in Parameters!
2. Uploaded new photos. They naturally appeared as white squares and the administration and the site - which is a problem! :idea:
3. Enable automatic generation of small images!
4. We chose a random image from the new and start edit it.
5. Push the button Image and again We see blank popup white screen! :D
6. Closed the blank popup window and finished editing of the image!
7. F5 or Ctrl F5, to refreshnem site.
8. All small images have appeared in the administrative panel and online!

Very stuped solution, but worked for us!
I don't know why it was happening! In general, for the first time I opened the Phoca Gallery. I've only tested it locally before time!

Excuse me my English! I hope You understand me! :)
Post Reply