]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/File.php
Add support for plugins to resize images
[quix0rs-gnu-social.git] / classes / File.php
index 9b703aa425ae25d9fc3b6e4c976b8fd778897151..b5bcec404168b8bbf9fbabfc3d58b69d6257ef93 100644 (file)
@@ -418,13 +418,6 @@ class File extends Managed_DataObject
         list($width, $height, $x, $y, $w2, $h2) =
                                 $image->scaleToFit($width, $height, $crop);
 
-        // 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. If this occurs, it's due to algorithm in ImageFile->scaleToFit
-            throw new ServerException('Bad thumbnail size parameters.');
-        }
-
         $params = array('file_id'=> $this->id,
                         'width'  => $width,
                         'height' => $height);
@@ -437,7 +430,9 @@ class File extends Managed_DataObject
         $outname = "thumb-{$width}x{$height}-" . $this->filename;
         $outpath = self::path($outname);
 
-        $image->resizeTo($outpath, $width, $height, $x, $y, $w2, $h2);
+        $image->resizeTo($outpath, array('width'=>$width, 'height'=>$height,
+                                         'x'=>$x,         'y'=>$y,
+                                         'w'=>$w2,        'h'=>$h2));
 
         // Avoid deleting the original
         if ($image->getPath() != $this->getPath()) {