mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 02:24:31 +00:00
Merge pull request #4287 from pixelfed/staging
Update ImageOptimizePipeline, improve support for disabling image opt…
This commit is contained in:
commit
eba44b62e6
3 changed files with 17 additions and 9 deletions
|
@ -39,16 +39,18 @@ class ImageOptimize implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
if(config('pixelfed.optimize_image') == false) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$media = $this->media;
|
$media = $this->media;
|
||||||
$path = storage_path('app/'.$media->media_path);
|
$path = storage_path('app/'.$media->media_path);
|
||||||
if (!is_file($path) || $media->skip_optimize) {
|
if (!is_file($path) || $media->skip_optimize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config('pixelfed.optimize_image') == false) {
|
||||||
|
ImageThumbnail::dispatch($media)->onQueue('mmo');
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
ImageResize::dispatch($media)->onQueue('mmo');
|
ImageResize::dispatch($media)->onQueue('mmo');
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,10 @@ class ImageResize implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!config('pixelfed.optimize_image')) {
|
||||||
|
ImageThumbnail::dispatch($media)->onQueue('mmo');
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
$img = new Image();
|
$img = new Image();
|
||||||
$img->resizeImage($media);
|
$img->resizeImage($media);
|
||||||
|
|
|
@ -61,12 +61,14 @@ class ImageUpdate implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(config('pixelfed.optimize_image')) {
|
||||||
if (in_array($media->mime, $this->protectedMimes) == true) {
|
if (in_array($media->mime, $this->protectedMimes) == true) {
|
||||||
ImageOptimizer::optimize($thumb);
|
ImageOptimizer::optimize($thumb);
|
||||||
if(!$media->skip_optimize) {
|
if(!$media->skip_optimize) {
|
||||||
ImageOptimizer::optimize($path);
|
ImageOptimizer::optimize($path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_file($path) || !is_file($thumb)) {
|
if (!is_file($path) || !is_file($thumb)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue