]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/imagefile.php
- Map notices to Facebook stream items
[quix0rs-gnu-social.git] / lib / imagefile.php
index 2134623b18ca1686ff17a43db35d50c56e277086..b70fd248e111dfc72d0a91b44c43cfda8a2c80c4 100644 (file)
@@ -67,10 +67,8 @@ class ImageFile
             $info[2] == IMAGETYPE_BMP ||
             ($info[2] == IMAGETYPE_WBMP && function_exists('imagecreatefromwbmp')) ||
             ($info[2] == IMAGETYPE_XBM && function_exists('imagecreatefromxbm')) ||
-            ($info[2] == IMAGETYPE_XPM && function_exists('imagecreatefromxpm')) ||
             ($info[2] == IMAGETYPE_PNG && function_exists('imagecreatefrompng')))) {
 
-            @unlink($_FILES[$param]['tmp_name']);
             throw new Exception(_('Unsupported image file format.'));
             return;
         }
@@ -87,6 +85,8 @@ class ImageFile
             break;
          case UPLOAD_ERR_INI_SIZE:
          case UPLOAD_ERR_FORM_SIZE:
+            // TRANS: Exception thrown when too large a file is uploaded.
+            // TRANS: %s is the maximum file size, for example "500b", "10kB" or "2MB".
             throw new Exception(sprintf(_('That file is too big. The maximum file size is %s.'),
                 ImageFile::maxFileSize()));
             return;
@@ -161,9 +161,6 @@ class ImageFile
          case IMAGETYPE_XBM:
             $image_src = imagecreatefromxbm($this->filepath);
             break;
-         case IMAGETYPE_XPM:
-            $image_src = imagecreatefromxpm($this->filepath);
-            break;
          default:
             throw new Exception(_('Unknown file type'));
             return;
@@ -206,10 +203,6 @@ class ImageFile
             //we don't want to save XBM... it's a rare format that we can't guarantee clients will support
             //save png instead
             $this->type = IMAGETYPE_PNG;
-        } else if($this->type == IMAGETYPE_XPM) {
-            //we don't want to save XPM... it's a rare format that we can't guarantee clients will support
-            //save png instead
-            $this->type = IMAGETYPE_PNG;
         }
 
         $outname = Avatar::filename($this->id,
@@ -250,11 +243,16 @@ class ImageFile
         $value = ImageFile::maxFileSizeInt();
 
         if ($value > 1024 * 1024) {
-            return ($value/(1024*1024)) . _('MB');
+            $value = $value/(1024*1024);
+            // TRANS: Number of megabytes. %d is the number.
+            return sprintf(_m('%dMB','%dMB',$value),$value);
         } else if ($value > 1024) {
-            return ($value/(1024)) . _('kB');
+            $value = $value/1024;
+            // TRANS: Number of kilobytes. %d is the number.
+            return sprintf(_m('%dkB','%dkB',$value),$value);
         } else {
-            return $value;
+            // TRANS: Number of bytes. %d is the number.
+            return sprintf(_m('%dB','%dB',$value),$value);
         }
     }