Upgrade images to v4

pull/6795/head
Your Name 4 weeks ago
parent 24e22b7cad
commit 552a55c2d2

1
.gitignore vendored

@ -31,3 +31,4 @@
# Exceptions - these *MUST* be last # Exceptions - these *MUST* be last
!/bootstrap/cache/.gitignore !/bootstrap/cache/.gitignore
!/public/vendor/horizon/.gitignore !/public/vendor/horizon/.gitignore
/public

@ -143,7 +143,7 @@ class StoryComposeController extends Controller
if ($localFs) { if ($localFs) {
$fpath = storage_path('app/'.$path); $fpath = storage_path('app/'.$path);
$img = $this->imageManager->read($fpath); $img = $this->imageManager->decodePath($fpath);
$quality = config_cache('pixelfed.image_quality'); $quality = config_cache('pixelfed.image_quality');
$encoder = in_array($photo->getMimeType(), ['image/jpeg', 'image/jpg']) ? $encoder = in_array($photo->getMimeType(), ['image/jpeg', 'image/jpg']) ?
new JpegEncoder($quality) : new JpegEncoder($quality) :
@ -156,7 +156,7 @@ class StoryComposeController extends Controller
$fileContent = $disk->get($path); $fileContent = $disk->get($path);
$img = $this->imageManager->read($fileContent); $img = $this->imageManager->decodeBinary($fileContent);
$quality = config_cache('pixelfed.image_quality'); $quality = config_cache('pixelfed.image_quality');
$encoder = in_array($photo->getMimeType(), ['image/jpeg', 'image/jpg']) ? $encoder = in_array($photo->getMimeType(), ['image/jpeg', 'image/jpg']) ?
new JpegEncoder($quality) : new JpegEncoder($quality) :
@ -215,7 +215,7 @@ class StoryComposeController extends Controller
$path = storage_path('app/'.$story->path); $path = storage_path('app/'.$story->path);
$extension = pathinfo($path, PATHINFO_EXTENSION); $extension = pathinfo($path, PATHINFO_EXTENSION);
$img = $this->imageManager->read($path); $img = $this->imageManager->decodePath($path);
$img = $img->crop($width, $height, $x, $y); $img = $img->crop($width, $height, $x, $y);
$img = $img->coverDown(1080, 1920); $img = $img->coverDown(1080, 1920);
@ -233,7 +233,7 @@ class StoryComposeController extends Controller
$fileContent = $disk->get($story->path); $fileContent = $disk->get($story->path);
$img = $this->imageManager->read($fileContent); $img = $this->imageManager->decodeBinary($fileContent);
$img = $img->crop($width, $height, $x, $y); $img = $img->crop($width, $height, $x, $y);
$img = $img->coverDown(1080, 1920); $img = $img->coverDown(1080, 1920);

@ -86,7 +86,7 @@ class AvatarOptimize implements ShouldQueue
} }
try { try {
$img = $imageManager->read($file); $img = $imageManager->decodePath($file);
$img = $img->coverDown(200, 200); $img = $img->coverDown(200, 200);
$encoded = $encoder->encode($img); $encoded = $encoder->encode($img);
file_put_contents($file, $encoded->toString()); file_put_contents($file, $encoded->toString());

@ -77,7 +77,7 @@ class ImageResizePipeline implements ShouldQueue
try { try {
$imageManager = ImageDriverManager::createImageManager(); $imageManager = ImageDriverManager::createImageManager();
$img = $imageManager->read($file); $img = $imageManager->decodePath($file);
$width = $img->width(); $width = $img->width();
$height = $img->height(); $height = $img->height();

@ -202,7 +202,7 @@ class Image
} }
} }
$img = $this->imageManager->read($fileContents); $img = $this->imageManager->decodeBinary($fileContents);
$ratio = $this->getAspect($img->width(), $img->height(), $thumbnail); $ratio = $this->getAspect($img->width(), $img->height(), $thumbnail);
$aspect = $ratio['dimensions']; $aspect = $ratio['dimensions'];

@ -34,7 +34,7 @@ class ImageDriverManager
self::getDriverClass(), self::getDriverClass(),
autoOrientation: (bool) ($options['autoOrientation'] ?? true), autoOrientation: (bool) ($options['autoOrientation'] ?? true),
decodeAnimation: (bool) ($options['decodeAnimation'] ?? true), decodeAnimation: (bool) ($options['decodeAnimation'] ?? true),
blendingColor: (string) ($options['blendingColor'] ?? 'ffffff'), backgroundColor: (string) ($options['backgroundColor'] ?? 'ffffff'),
strip: (bool) ($options['strip'] ?? true) strip: (bool) ($options['strip'] ?? true)
); );
} }

@ -18,8 +18,8 @@
"buzz/laravel-h-captcha": "^1.0.4", "buzz/laravel-h-captcha": "^1.0.4",
"endroid/qr-code": "^6.0", "endroid/qr-code": "^6.0",
"guzzlehttp/guzzle": "^7.10", "guzzlehttp/guzzle": "^7.10",
"intervention/image-laravel": "^1.5", "intervention/image-laravel": "^4.1",
"intervention/image-driver-vips": "^1.0", "intervention/image-driver-vips": "^4.1",
"jenssegers/agent": "^2.6", "jenssegers/agent": "^2.6",
"laravel-notification-channels/expo": "^2.0.0", "laravel-notification-channels/expo": "^2.0.0",
"laravel-notification-channels/webpush": "^10.2", "laravel-notification-channels/webpush": "^10.2",

663
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -32,7 +32,7 @@ return [
| - "decodeAnimation" decides whether a possibly animated image is | - "decodeAnimation" decides whether a possibly animated image is
| decoded as such or whether the animation is discarded. | decoded as such or whether the animation is discarded.
| |
| - "blendingColor" Defines the default blending color. | - "backgroundColor" Defines the default background color.
| |
| - "strip" controls if meta data like exif tags should be removed when | - "strip" controls if meta data like exif tags should be removed when
| encoding images. | encoding images.
@ -41,7 +41,7 @@ return [
'options' => [ 'options' => [
'autoOrientation' => true, 'autoOrientation' => true,
'decodeAnimation' => true, 'decodeAnimation' => true,
'blendingColor' => env('IMAGE_BLENDINGCOLOR', 'ffffff'), 'backgroundColor' => env('IMAGE_BACKGROUNDCOLOR', 'ffffff'),
'strip' => env('IMAGE_STRIP', true), 'strip' => env('IMAGE_STRIP', true),
] ]
]; ];

Loading…
Cancel
Save