diff options
author | Sean Murphy <sgmurphy@gmail.com> | 2009-02-05 15:01:44 -0500 |
---|---|---|
committer | Sean Murphy <sgmurphy@gmail.com> | 2009-02-05 15:01:44 -0500 |
commit | d4bdb2dc1924e2753baa4cf1751acb08b6ed3cae (patch) | |
tree | fbe24952537eeb5ee255d8282658393d6636f923 /lib | |
parent | 746a5d75071a2a7c913c522ea78f2b88b87f4ce2 (diff) |
Better fix for displaying max file size.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common.php | 1 | ||||
-rw-r--r-- | lib/imagefile.php | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/common.php b/lib/common.php index 825ba0ff7..482800876 100644 --- a/lib/common.php +++ b/lib/common.php @@ -24,7 +24,6 @@ define('LACONICA_VERSION', '0.7.0'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); define('AVATAR_MINI_SIZE', 24); -define('MAX_AVATAR_SIZE', 256 * 1024); define('NOTICES_PER_PAGE', 20); define('PROFILES_PER_PAGE', 20); diff --git a/lib/imagefile.php b/lib/imagefile.php index f9f47a47e..74c3d14f0 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -183,9 +183,14 @@ class ImageFile @unlink($this->filename); } - static function maxFileSize() + static function maxFileSize($return_bytes = false) { - $limit = min(ImageFile::strToInt(ini_get('post_max_size')), ImageFile::strToInt(ini_get('upload_max_filesize'))); + $limit = min(ImageFile::strToInt(ini_get('post_max_size')), ImageFile::strToInt(ini_get('upload_max_filesize')), ImageFile::strToInt(ini_get('memory_limit'))); + + if ($return_bytes) { + return $limit; + } + return ($limit/(1024*1024)).'MB'; } |