freedomsex/photo-upload-bundle

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 3

Type:symfony-bundle

pkg:composer/freedomsex/photo-upload-bundle


README

Component for projects FreedomSex.

Provides image file download service. The interface of the entity of the file. Presets path and file naming configurations. A usage strategy may turn out to be project specific.

Default configuration

photo_upload:
    width: 600  # max width
    height: 800 # max height
    quality: 80 # jpeg quality 
    namer: 'upload_file_namer'

Basic usage

# PhotoController

use FreedomSex\PhotoUploadBundle\Services\FileUploader;
use FreedomSex\PhotoUploadBundle\Entity\FileInterface;

    public $fileUploader;

    public function __construct(FileUploader $fileUploader)
    {
        $this->fileUploader = $fileUploader;
    }

    public function upload(UploadedFile $file)
    {
        $entity = new Photo(); # implements FileInterface
        $this->fileUploader->upload($file, $entity);
    }