]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Drop using the proxy large size for image preview
[friendica.git] / src / Model / Photo.php
index f393211548dc0eed7e8f63706dc503c10104943a..cae035f36e46f2cbd0ded9130091c079585b917a 100644 (file)
@@ -1001,7 +1001,7 @@ class Photo
                $filesize = strlen($image->asString());
                $width    = $image->getWidth();
                $height   = $image->getHeight();
-       
+
                if ($maximagesize && ($filesize > $maximagesize)) {
                        // Scale down to multiples of 640 until the maximum size isn't exceeded anymore
                        foreach ([5120, 2560, 1280, 640, 320] as $pixels) {
@@ -1014,8 +1014,8 @@ class Photo
                                }
                        }
                }
-       
-               return $image;  
+
+               return $image;
        }
 
        /**
@@ -1031,7 +1031,7 @@ class Photo
                        $image->scaleDown($max_length);
                        Logger::info('File upload: Scaling picture to new size', ['max-length' => $max_length]);
                }
-               
+
                return self::resizeToFileSize($image, Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')));
        }
 
@@ -1255,16 +1255,16 @@ class Photo
                        return -1;
                }
 
-               if ($width > 640 || $height > 640) {
-                       $image->scaleDown(640);
+               if ($width > Proxy::PIXEL_MEDIUM || $height > Proxy::PIXEL_MEDIUM) {
+                       $image->scaleDown(Proxy::PIXEL_MEDIUM);
                }
 
-               if ($width > 320 || $height > 320) {
+               if ($width > Proxy::PIXEL_SMALL || $height > Proxy::PIXEL_SMALL) {
                        $result = self::store($image, $uid, 0, $resource_id, $filename, $album, 1, self::DEFAULT, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $description);
                        if ($result) {
                                $preview = 1;
                        }
-                       $image->scaleDown(320);
+                       $image->scaleDown(Proxy::PIXEL_SMALL);
                        $result = self::store($image, $uid, 0, $resource_id, $filename, $album, 2, self::DEFAULT, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $description);
                        if ($result && ($preview == 0)) {
                                $preview = 2;