I got MaxiGallery working fine, but when I tried to upload a file, I get this error:
Fatal error: Out of memory (allocated 35389440) (tried to allocate 12908 bytes) in /homepages/23/d193917934/htdocs/clearlyorganized/assets/snippets/maxigallery/watermark/Thumbnail.class.php on line 188
The files are .png, less than 3MB
PM me to find out how you can get a FREE ipad 2!
-
☆ A M B ☆
- 24,524 Posts
Check your phpinfo() for how much memory a process can use. Keep in mind that not only does MaxiGallery upload the file, it also processes it, with watermarks, backgrounds, shadows, etc... all of this takes up memory in excess of the actual image size. See the Wiki article:
http://wiki.modxcms.com/index.php/MaxiGallery#Introduction
More here:
http://tikiwiki.org/tiki-read_article.php?articleId=82
If you
really want to know how PHP handles memory, try this:
http://www.quepublishing.com/articles/article.asp?p=516587&rl=1
And while doing a bit of quick Googling on the subject, I found this very interesting (although not completely relevant to the question here) idea:
http://www.captain.at/ajax-file-upload.php
PM me to find out how you can get a FREE ipad 2!
How many pics you are trying to upload at a time? What kind of snippet call you are using? Apache can also have memory_limit setting with "php_admin_value memory_limit"... I would think that 40MB is plenty though, My local settings has 8MB limit, but the thumbnail class rises it to 32MB. Of course, it still might not be enough if you are uploading 10x3mb images and there is some processing done to them.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
I’m just trying to upload one single image.
PM me to find out how you can get a FREE ipad 2!
Hmm.. I looked at the code and it probably is that there is an error in it.. In watermark/thumbnail.class.php in line 342-349 it says:
$memory_limit = ini_get('memory_limit');
if ($memory_limit < $this->memory_limit) {
ini_set('memory_limit',$this->memory_limit);
}
$max_execution_time = ini_get('max_execution_time');
if ($max_execution_time < $this->max_execution_time) {
ini_set('max_execution_time',$this->max_execution_time);
}
But that won’t work because the memory_limit setting is not a number but a number with M suffix. So to fix it temporarily, change that to:
ini_set('memory_limit',$this->memory_limit);
ini_set('max_execution_time',$this->max_execution_time);
So the memory_limit will be always increased. I’ll fix that soon..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Hi Doze,
Tried the fix for the Thumbnail.class.php file.
It helped me upload some 150 - 250KB JPEG’s singly and then in batches, then errored on a 350KB file!
Once it has failed you can’t upload anymore pictures, even smaller ones!
I tried it on a new gallery page without the dropshadow call but it failed first time on a 350KB file.
And then failed on every file I tried.
If I look in the gallery folder there is one picture, no thumbnail.
Regards
David
And has the 0.4.1 work any better? Can you try with it now?
"He can have a lollipop any time he wants to. That's what it means to be a programmer."