/** * @param \livetyping\hermitage\foundation\bus\commands\StoreImageCommand $command */ public function handle(StoreImageCommand $command) { $image = new Image($command->getBinary(), $command->getMimeType(), $this->generator->path()); $image = $this->processor->optimize($image); $this->storage->put($image); $command->setPath($image->getPath()); }
/** * @param \livetyping\hermitage\foundation\bus\commands\MakeImageVersionCommand $command * * @throws \livetyping\hermitage\foundation\exceptions\ImageNotFoundException * @throws \livetyping\hermitage\foundation\exceptions\UnknownVersionNameException */ public function handle(MakeImageVersionCommand $command) { $image = $this->storage->get($command->getPathToOriginal()); $image = $this->processor->make($image, $command->getVersion()); $this->storage->put($image); }