diff options
| author | Chad Kieffer <ckieffer@gmail.com> | 2011-04-23 15:02:29 -0400 |
|---|---|---|
| committer | Chad Kieffer <ckieffer@gmail.com> | 2011-04-23 15:02:29 -0400 |
| commit | 268f9425d918d14e1839b3e22203a8869093f3f0 (patch) | |
| tree | 3a0676e1fa0b158262e9ae8f0faef0474998b061 /modules/gallery/helpers/graphics.php | |
| parent | 07f654c8d9918608c8229404585874ce5aba7ab2 (diff) | |
| parent | a9eb995dd2b64667c300c6193656b6cdfeb4e2a5 (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/graphics.php')
| -rw-r--r-- | modules/gallery/helpers/graphics.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 04501132..8d8853b0 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -316,7 +316,7 @@ class graphics_Core { // ImageMagick & GraphicsMagick $magick_kits = array( "imagemagick" => array( - "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v", + "name" => "ImageMagick", "binary" => "convert", "version" => "convert -version", "version_regex" => "/Version: \S+ (\S+)/"), "graphicsmagick" => array( "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version", @@ -423,4 +423,23 @@ class graphics_Core { return true; } + + /** + * Return the max file size that this graphics toolkit can handle. + */ + static function max_filesize() { + if (module::get_var("gallery", "graphics_toolkit") == "gd") { + $memory_limit = trim(ini_get("memory_limit")); + $memory_limit_bytes = num::convert_to_bytes($memory_limit); + + // GD expands images in memory and uses 4 bytes of RAM for every byte + // in the file. + $max_filesize = $memory_limit_bytes / 4; + $max_filesize_human_readable = num::convert_to_human_readable($max_filesize); + return array($max_filesize, $max_filesize_human_readable); + } + + // Some arbitrarily large size + return array(1000000000, "1G"); + } } |
