Dont update png files
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
fe3a0625a1
commit
24c53106bd
|
@ -6,8 +6,8 @@ use Illuminate\Support\Collection;
|
||||||
use Intervention\Image\ImageManager;
|
use Intervention\Image\ImageManager;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
|
||||||
class PngCompressor extends Compressor {
|
class PngCompressor extends Compressor
|
||||||
|
{
|
||||||
protected function getExtension(): string
|
protected function getExtension(): string
|
||||||
{
|
{
|
||||||
return 'png';
|
return 'png';
|
||||||
|
@ -24,7 +24,7 @@ class PngCompressor extends Compressor {
|
||||||
$mimetype = mime_content_type($path);
|
$mimetype = mime_content_type($path);
|
||||||
|
|
||||||
system('imagemin '.escapeshellarg($path).' --plugin=pngquant > '.escapeshellarg($output));
|
system('imagemin '.escapeshellarg($path).' --plugin=pngquant > '.escapeshellarg($output));
|
||||||
system("mv ".escapeshellarg($output)." ".escapeshellarg($path));
|
system('mv '.escapeshellarg($output).' '.escapeshellarg($path));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$path => [$path],
|
$path => [$path],
|
||||||
|
@ -43,12 +43,10 @@ class PngCompressor extends Compressor {
|
||||||
|
|
||||||
public function start(): void
|
public function start(): void
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function end(): void
|
public function end(): void
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resize(Collection $size, bool $update, callable $callback): void
|
public function resize(Collection $size, bool $update, callable $callback): void
|
||||||
|
@ -65,8 +63,11 @@ class PngCompressor extends Compressor {
|
||||||
|
|
||||||
$versionFilename = $this->media->versionsDirPath().'/'.$this->versionFilename($destWidth, $destHeight);
|
$versionFilename = $this->media->versionsDirPath().'/'.$this->versionFilename($destWidth, $destHeight);
|
||||||
|
|
||||||
|
if ($update && Storage::exists($versionFilename)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->moveTo($temp, $versionFilename);
|
$this->moveTo($temp, $versionFilename);
|
||||||
call_user_func($callback, $this->media, Storage::path($versionFilename));
|
call_user_func($callback, $this->media, Storage::path($versionFilename));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue