Been successfully using nGen File Field to populate a Slide Show Pro gallery. But now there’s about 8 or more separate galleries (each containing several photos) I’m getting the following error from the Control Panel when I try to add or edit a gallery.
Fatal error: Out of memory (allocated 66322432) (tried to allocate 17024 bytes) in /home/shakethe/public_html/admin/extensions/fieldtypes/ngen_file_field/ft.ngen_file_field.php on line 842
I can up my memory limit above 64MB with my current hosts without paying big bucks for a dedicated server!
Can someone please help me figure out a way to keep this working under the 64MB limit please?
Thanks!
Moved to Extensions Forum by Moderator
I think, it because in this moment, nGen tried to create the thumbs for your images. And some of images are too big. You can calculate the memory needs for you image (estimate): Num bytes = Width * Height * Bytes per pixel * Overhead additional info
Of course the ngenworks can consult you to more better in this topic, just 2c from my side: Or actually turn it off? As I know, is no easy way to turned it of. Only to edit the source.
Can I improve the thumbnail creation from nGen? I make some investigation of this issue for my ext. , so I see 2 ways at this moment: 1. Dynamically allocate need memory source
<?php
function setMemoryForImage( $filename ){
$imageInfo = getimagesize($filename);
$MB = 1048576; // number of bytes in 1M
$K64 = 65536; // number of bytes in 64K
$TWEAKFACTOR = 1.5; // Or whatever works for you
$memoryNeeded = round( ( $imageInfo[0] * $imageInfo[1]
* $imageInfo['bits']
* $imageInfo['channels'] / 8
+ $K64
) * $TWEAKFACTOR
);
//ini_get('memory_limit') only works if compiled with "--enable-memory-limit" also
//Default memory limit is 8MB so well stick with that.
//To find out what yours is, view your php.ini file.
$memoryLimit = 8 * $MB;
if (function_exists('memory_get_usage') &&
memory_get_usage() + $memoryNeeded > $memoryLimit)
{
$newLimit = $memoryLimitMB + ceil( ( memory_get_usage()
+ $memoryNeeded
- $memoryLimit
) / $MB
);
ini_set( 'memory_limit', $newLimit . 'M' );
return true;
}else
return false;
}
}
?>Matt – I could be wrong, but the memory-intensive processes of File Field should only happen once - after first installing it and loading up an entry screen which has a field linked to a directory containing a tonne of images. Once the thumbs are created, it’s very fast. From there-on-in, it only has to generate one thumbnail at a time (when new ones are added).
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.