explicitly use webp
This commit is contained in:
@@ -118,7 +118,6 @@ class StoreUploadedFileJob implements ShouldQueue
|
||||
$variants = [];
|
||||
|
||||
$originalImage = Image::make($this->uploadedFilePath);
|
||||
$optimizerChain = OptimizerChainFactory::create();
|
||||
|
||||
$dimensions = [$originalImage->getWidth(), $originalImage->getHeight()];
|
||||
$this->media->dimensions = implode('x', $dimensions);
|
||||
@@ -151,8 +150,7 @@ class StoreUploadedFileJob implements ShouldQueue
|
||||
|
||||
// Optimize and store image
|
||||
$tempImagePath = tempnam(sys_get_temp_dir(), 'optimize');
|
||||
$image->save($tempImagePath);
|
||||
$optimizerChain->optimize($tempImagePath);
|
||||
$image->encode('webp', 75)->save($tempImagePath);
|
||||
Storage::disk($storageDisk)->putFileAs('/', new SplFileInfo($tempImagePath), $newFilename);
|
||||
unlink($tempImagePath);
|
||||
}//end if
|
||||
@@ -168,6 +166,7 @@ class StoreUploadedFileJob implements ShouldQueue
|
||||
}
|
||||
}
|
||||
|
||||
$this->media->mime_type = 'image/webp';
|
||||
$this->media->variants = $variants;
|
||||
}//end if
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"league/flysystem-aws-s3-v3": "^3.12",
|
||||
"owen-it/laravel-auditing": "^13.0",
|
||||
"php-ffmpeg/php-ffmpeg": "^1.1",
|
||||
"spatie/image-optimizer": "^1.6",
|
||||
"sunspikes/clamav-validator": "*",
|
||||
"thiagoalessio/tesseract_ocr": "^2.12"
|
||||
},
|
||||
|
||||
59
composer.lock
generated
59
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "4b954b0d401cb67d092d9e0a569111d9",
|
||||
"content-hash": "9156e3b9b4d443b3432f1f303cc2fe97",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@@ -3975,61 +3975,6 @@
|
||||
],
|
||||
"time": "2023-04-15T23:01:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/image-optimizer",
|
||||
"version": "1.6.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/image-optimizer.git",
|
||||
"reference": "d997e01ba980b2769ddca2f00badd3b80c2a2512"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/image-optimizer/zipball/d997e01ba980b2769ddca2f00badd3b80c2a2512",
|
||||
"reference": "d997e01ba980b2769ddca2f00badd3b80c2a2512",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"php": "^7.3|^8.0",
|
||||
"psr/log": "^1.0 | ^2.0 | ^3.0",
|
||||
"symfony/process": "^4.2|^5.0|^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"pestphp/pest": "^1.21",
|
||||
"phpunit/phpunit": "^8.5.21|^9.4.4",
|
||||
"symfony/var-dumper": "^4.2|^5.0|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\ImageOptimizer\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Easily optimize images using PHP",
|
||||
"homepage": "https://github.com/spatie/image-optimizer",
|
||||
"keywords": [
|
||||
"image-optimizer",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/image-optimizer/issues",
|
||||
"source": "https://github.com/spatie/image-optimizer/tree/1.6.4"
|
||||
},
|
||||
"time": "2023-03-10T08:43:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/temporary-directory",
|
||||
"version": "2.1.1",
|
||||
@@ -9508,5 +9453,5 @@
|
||||
"php": "^8.0.2"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user