IMPORTANT NOTE: It depends on your server settings that how many images you can upload at a time and how big. The image masking process for example is very slow and you might get a "Maximum execution time of NN seconds exceeded" -error message, if you are trying to upload many images at the same time with imagemasking on.. or if the images are large. Also when using big images, you may get "Memory Size Exhausted" -error as the image processing takes alot of memory too. These errors are not errors in the snippet code, they are caused by server settings. MaxiGallery script tries to use ini_set to increase the execution time and memory limit if needed, but it cannot do it if php is running in safe mode. You don’t necessarily see any error page, it can also just return a blank page when you upload pictures and if you look into /assets/galleries/<docid>/ folder, you may see that it has done for example thumbnail for some picture but then stopped there as either memory limit or maximum execution time got reached.
So, Check these values from php.ini:
- max_execution_time, this is the maximum execution time allowed for each script, in seconds (it takes quite some time for maxigallery script to process the images if there are many of them and many imaging "filters" used).
- max_input_time, this is the maximum time each script may spend parsing request data, in seconds.
- memory_limit, this is the maximum amount of memory in megabytes that a script may consume (maxigallery keeps the images in memory while it makes thumbnails etc).
- post_max_size this is the maximum size of POST data in megabytes that PHP will accept (the pictures travel in the post data).
- upload_max_filesize this is the maximum allowed size for uploaded files in megabytes.
These settings can also be configured from Apache, so you might want to see if the following can be found from your httpd.conf:
- php_admin_value upload_max_filesize Sets the corresponding php setting, see above.
- php_admin_value post_max_size Sets the corresponding php setting, see above.
- php_admin_value memory_limit Sets the corresponding php setting, see above.
- LimitRequestBody Same as post_max_size php setting, but for apache.
function getTemplate($tpl){
// by Mark Kaplan
global $modx;
$template = "";
if ($modx->getChunk($tpl) != "") {my_die("getTemplate($tpl)");
$template = $modx->getChunk($tpl);
} else if(substr($tpl, 0, 6) == "@FILE:") {
$template = $this->get_file_contents($modx->config['base_path'].substr($tpl, 6));
} else if(substr($tpl, 0, 6) == "@CODE:") {
$template = substr($tpl, 6);
} else {
$template = FALSE;
}
return $template;
}
function getTemplate($tpl){
// by Mark Kaplan
global $modx;
switch (substr($tpl, 0, 6)) {
case '@FILE:':
$template = $this->get_file_contents($modx->config['base_path'].substr($tpl, 6));
break;
case '@CODE:':
$template = substr($tpl, 6);
break;
case '@CHUNK':
$template = $modx->getChunk(substr($tpl, 7));
break;
default:
$template = $modx->getChunk($tpl);
break;
}
return $template;
}