Skip to content

Commit

Permalink
Small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasHermanek committed Nov 4, 2024
1 parent 918bf05 commit 03ba8ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/Domain/Image/ImageStatusFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ protected function processAssetFile(AssetFile $assetFile, AdapterFile $file): As
$imageFile = $this->getImage($assetFile);
$this->imageManipulator->loadFile($file->getRealPath());

// todo temporary stops compute MDC
$imageFile->getImageAttributes()
->setAnimated($this->imageManipulator->isAnimated())
// ->setMostDominantColor($this->imageManipulator->getMostDominantColor())
->setMostDominantColor($this->imageManipulator->getMostDominantColor())
;

$this->optimalCropsProcessor->process($imageFile, $file);
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/ImageFileOptimalResize/OptimalResizeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function createCrop(ImageFile $imageFile, AdapterFile $file, int $size):
$tmpFilesystem->ensureDirectory($tmpPath);
// Write rotated crop file
$this->imageManipulator->writeToFile($tmpFilesystem->extendPath($tmpPath), false);
// // Write file to target storage
// // Write file to target storage
$assetFileSystem = $this->fileSystemProvider->getFilesystemByStorable($imageFile);
$storagePath = $this->createOptimalCropPath($imageFile, $size, $imageFile->getImageAttributes()->getRotation());
$assetFileSystem->writeStream($storagePath, $tmpFilesystem->readStream($tmpPath));
Expand Down
2 changes: 2 additions & 0 deletions src/Image/ImageManipulatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,6 @@ public function getStream(string $extension);
* @throws ImageManipulatorException
*/
public function applyFilterStack(FilterStack $filterStack): void;

public function clean(bool $clean = true): void;
}
16 changes: 8 additions & 8 deletions src/Image/VispImageManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use AnzuSystems\CoreDamBundle\Logger\DamLogger;
use AnzuSystems\CoreDamBundle\Model\ValueObject\Color;
use AnzuSystems\SerializerBundle\Exception\SerializerException;
use Jcupitt\Vips\Config;
use Jcupitt\Vips\Exception;
use Jcupitt\Vips\Image;
use Jcupitt\Vips\Config;
use League\Flysystem\FilesystemException;
use Throwable;

Expand Down Expand Up @@ -243,6 +243,13 @@ public function getHeight(): int
return (int) $this->image->height;
}

public function clean(bool $clean = true): void
{
if (true === $clean) {
$this->image = null;
}
}

/**
* @throws ImageManipulatorException
*/
Expand All @@ -253,13 +260,6 @@ private function ensureImage(): void
}
}

public function clean(bool $clean = true): void
{
if (true === $clean) {
$this->image = null;
}
}

private function disableCache(): void
{
Config::CacheSetMax(0);
Expand Down

0 comments on commit 03ba8ba

Please sign in to comment.