]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Better fix for displaying max file size.
authorSean Murphy <sgmurphy@gmail.com>
Thu, 5 Feb 2009 20:01:44 +0000 (15:01 -0500)
committerSean Murphy <sgmurphy@gmail.com>
Thu, 5 Feb 2009 20:01:44 +0000 (15:01 -0500)
actions/avatarsettings.php
actions/grouplogo.php
lib/common.php
lib/imagefile.php

index 79ca6b7898336f3e8c081ddcd5e63ecccff20ad3..139d85b4c28e1cf6933998dd9d1c10d21754fdc0 100644 (file)
@@ -155,7 +155,7 @@ class AvatarsettingsAction extends AccountSettingsAction
         $this->element('input', array('name' => 'MAX_FILE_SIZE',
                                       'type' => 'hidden',
                                       'id' => 'MAX_FILE_SIZE',
-                                      'value' => MAX_AVATAR_SIZE));
+                                      'value' => ImageFile::maxFileSize(true)));
         $this->elementEnd('li');
         $this->elementEnd('ul');
 
index 4be7c4e12fcab4d763463a875ef537b235866261..473303373f364ad05a41d2b70ecfb593e100eaac 100644 (file)
@@ -229,7 +229,7 @@ class GrouplogoAction extends Action
         $this->element('input', array('name' => 'MAX_FILE_SIZE',
                                       'type' => 'hidden',
                                       'id' => 'MAX_FILE_SIZE',
-                                      'value' => MAX_AVATAR_SIZE));
+                                      'value' => ImageFile::maxFileSize(true)));
         $this->elementEnd('li');
         $this->elementEnd('ul');
 
index 825ba0ff75d10b99aae6de7ab3fb41f9508246a1..482800876d7a92e45fc53d2305966d5458bd84f6 100644 (file)
@@ -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);
index f9f47a47ee5a8f3f4d1e5bb6025a0c41005b45d8..74c3d14f03943c2a9691e8ebe2a8dd1822271e70 100644 (file)
@@ -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';
     }