only one copy of get_memory_limit...

git-svn-id: file:///home/shish/svn/shimmie2/trunk@9 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish
2007-04-24 19:12:05 +00:00
parent 65be47dbb7
commit b1b2edf021
3 changed files with 25 additions and 46 deletions

View File

@@ -65,6 +65,29 @@ function to_shorthand_int($int) {
}
}
function get_memory_limit() {
global $config;
// thumbnail generation requires lots of memory
$default_limit = 8*1024*1024;
$shimmie_limit = parse_shorthand_int($config->get_int("thumb_gd_mem_limit"));
if($shimmie_limit < 3*1024*1024) {
// we aren't going to fit, override
$shimmie_limit = $default_limit;
}
ini_set("memory_limit", $shimmie_limit);
$memory = parse_shorthand_int(ini_get("memory_limit"));
// changing of memory limit is disabled / failed
if($memory == -1) {
$memory = $default_limit;
}
return $memory;
}
function bbcode2html($text) {
$text = trim($text);
$text = html_escape($text);