juniwalk / image-storage
This package is abandoned and no longer maintained.
No replacement package was suggested.
Image storing utility that will help you save images into defined storages.
v1.0.0
2016-08-16 11:23 UTC
Requires
- php: ^7.0
- nette/utils: ^2.0
Requires (Dev)
- nette/tester: ^1.0
Suggests
- nette/http: Allows directly storing uploaded files using Media::fromUpload($uploadedFile).
This package is auto-updated.
Last update: 2020-07-27 15:26:58 UTC
README
Image storing utility that will help you save images into defined storages.
Installation
$ composer require juniwalk/image-storage
Configuration
extensions: imageStorage: JuniWalk\ImageStorage\DI\ImageStorageExtension imageStorage: directory: /images # Relative to $wwwDir allowOverwrite: TRUE
Adding new storages
services: imageStorage.storage.avatar: class: JuniWalk\ImageStorage\Storages\LocalStorage(avatar, jpg) setup: - addFilter(JuniWalk\ImageStorage\Filters\ResizeFilter(512, 512, 'EXACT')) - addFilter(JuniWalk\ImageStorage\Filters\WatermarkFilter(%wwwDir%/images/watermark.png))
Usage
/** @var JuniWalk\ImageStorage\Media */ $media = Media::fromImage(string $name, Nette\Utils\Image $image) $media = Media::fromUpload(Nette\Http\FileUpload $fileUpload, string $name = NULL); $media = Media::fromFile(string $filename); $media = Media::fromString(string $name, string $content); /** @var \JuniWalk\ImageStorage\ImageStorage */ $imageStorage = $this->getImageStorage(); /** @var string Relative path to $wwwDir */ $path = $imageStorage->store(string $storage, Media $media);