]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
[MEDIA] Fixed wrong image cropping
authorMiguel Dantas <biodantasgs@gmail.com>
Sat, 3 Aug 2019 20:02:21 +0000 (21:02 +0100)
committerMiguel Dantas <biodantasgs@gmail.com>
Sat, 3 Aug 2019 20:02:21 +0000 (21:02 +0100)
lib/imagefile.php

index 9f0d386b465cc50225251c009263a1f2275d442a..2d43761bbc0631ada4170d7d32d235769a557f39 100644 (file)
@@ -345,7 +345,13 @@ class ImageFile extends MediaFile
             $img = $img->orientate();
         }
 
-        $img->crop($box['width'], $box['height'], $box['x'], $box['y']);
+        $img->fit($box['width'], $box['height'],
+                  function ($constraint) {
+                      if (common_config('attachments', 'upscale') !== true) {
+                          $constraint->upsize(); // Prevent upscaling
+                      }
+                  }
+        );
 
         // Ensure we save in the correct format and allow customization based on type
         $type = $this->preferredType();