memory limit for IM too

git-svn-id: file:///home/shish/svn/shimmie2/trunk@220 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-05 17:14:27 +00:00
parent 8e261f03b2
commit 431b6a653e
3 changed files with 7 additions and 5 deletions

View file

@ -16,7 +16,7 @@ class Config {
'thumb_width' => 192, # index
'thumb_height' => 192, # index
'thumb_quality' => 75, # index
'thumb_gd_mem_limit' => '8MB', # upload
'thumb_mem_limit' => '8MB', # upload
'tags_default' => 'map', # (ignored)
'tags_min' => '2', # tags
'upload_count' => 3, # upload

View file

@ -45,7 +45,7 @@ class ImageIO extends Extension {
$sb->add_int_option("thumb_quality");
$sb->add_label(" % quality ");
$sb->add_shorthand_int_option("thumb_gd_mem_limit", "<br>Max GD memory use: ");
$sb->add_shorthand_int_option("thumb_mem_limit", "<br>Max memory use: ");
$event->panel->add_block($sb);
}
@ -54,7 +54,7 @@ class ImageIO extends Extension {
$event->config->set_int_from_post("thumb_width");
$event->config->set_int_from_post("thumb_height");
$event->config->set_int_from_post("thumb_quality");
$event->config->set_int_from_post("thumb_gd_mem_limit");
$event->config->set_int_from_post("thumb_mem_limit");
}
}
// }}}
@ -99,8 +99,9 @@ class ImageIO extends Extension {
$w = $config->get_int("thumb_width");
$h = $config->get_int("thumb_height");
$q = $config->get_int("thumb_quality");
$mem = $config->get_int("thumb_max_memory") / 1024 / 1024; // IM takes memory in MB
exec("convert {$inname}[0] -geometry {$w}x{$h} -quality {$q} jpg:$outname");
exec("convert {$inname}[0] -limit memory {$mem} -geometry {$w}x{$h} -quality {$q} jpg:$outname");
return true;
}

View file

@ -41,7 +41,8 @@ class RegenThumb extends Extension {
switch($program) {
case 'convert':
if(file_exists($f_thumb)) unlink($f_thumb);
exec("convert {$f_image}[0] -geometry {$w}x{$h} -quality {$q} jpg:$f_thumb");
$mem = $config->get_int("thumb_max_memory") / 1024 / 1024; // IM takes memory in MB
exec("convert {$f_image}[0] -limit memory {$mem} -geometry {$w}x{$h} -quality {$q} jpg:$f_thumb");
break;
case 'gd':
$this->make_thumb_gd($f_image, $f_thumb);