]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Handle File thumbnail errors better
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Apr 2014 18:26:32 +0000 (20:26 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 28 Apr 2014 18:26:32 +0000 (20:26 +0200)
classes/File.php
lib/unsupportedmediaexception.php

index 45aee64a43763a903f3db537f005772ea7833599..29dc7b5492a841851c82923e894f70eac967e658 100644 (file)
@@ -448,7 +448,7 @@ class File extends Managed_DataObject
             // Old files may have 0 until migrated with scripts/upgrade.php
             // For any legitimately unrepresentable ones, we could generate our
             // own image (like a square with MIME type in text)
             // Old files may have 0 until migrated with scripts/upgrade.php
             // For any legitimately unrepresentable ones, we could generate our
             // own image (like a square with MIME type in text)
-            throw new UnsupportedMediaException('Object does not have an image representation.');
+            throw new UnsupportedMediaException('No image geometry available.');
         }
 
         if ($width === null) {
         }
 
         if ($width === null) {
@@ -469,8 +469,8 @@ class File extends Managed_DataObject
         // Doublecheck that parameters are sane and integers.
         if ($width < 1 || $width > common_config('thumbnail', 'maxsize')
                 || $height < 1 || $height > common_config('thumbnail', 'maxsize')) {
         // Doublecheck that parameters are sane and integers.
         if ($width < 1 || $width > common_config('thumbnail', 'maxsize')
                 || $height < 1 || $height > common_config('thumbnail', 'maxsize')) {
-            // Fail on bad width parameter.
-            throw new ServerException('Bad thumbnail width or height parameter');
+            // Fail on bad width parameter. If this occurs, it's due to algorithm in ImageFile::getScalingValues
+            throw new ServerException('Bad thumbnail size parameters.');
         }
 
         $params = array('file_id'=> $this->id,
         }
 
         $params = array('file_id'=> $this->id,
index df6916a76c1ea7c575ebaf49c233f48e19616ac7..269e783c494dca88c61660b85817a20514c0c0c4 100644 (file)
@@ -31,9 +31,9 @@ if (!defined('GNUSOCIAL')) { exit(1); }
 
 class UnsupportedMediaException extends ServerException
 {
 
 class UnsupportedMediaException extends ServerException
 {
-    public function __construct($msg, $path)
+    public function __construct($msg, $path=null)
     {
     {
-        common_debug(sprintf('UnsupportedMediaException "%1$s" for file "%2$s"', $msg, $path));
+        common_debug(sprintf('UnsupportedMediaException "%1$s". File path (if given): "%2$s"', $msg, $path));
         parent::__construct($msg);
     }
 }
         parent::__construct($msg);
     }
 }