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