2017 © Pedro Peláez
 

library files

File handling library

image

digbang/files

File handling library

  • Tuesday, January 9, 2018
  • by dpgover
  • Repository
  • 4 Watchers
  • 0 Stars
  • 139 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 827 % Grown

The README.md

digbang/files

This library helps with the handling of files and images. The files are stored physically using Laravel's filesystem configuration; and logically into a table in the database., (*1)

Usage

Mappings

$builder->manyToOne(File::class, 'propertyName'); $builder->belongsTo(ImageFile::class, 'imagePropertyName');, (*2)

Image Handling

Each ImageFile has an optional parent image (the original one). This allows to have a tree of curated images attached to the original., (*3)

For example:, (*4)


public function __construct(FileRepository $repository, ImageCurator $curator) { $this->repository = $repository; $this->curator = $curator; } public function curateImage(ImageFile $originalImage): ImageFile { if (! ($curatedImage = $originalImage->getCurated('SOME_IDENTIFICATION_KEY'))) { $originalImage->setContentGetter(function () use ($originalImage) { return $this->repository->getContents($originalImage->getId()); }); $curation = $this->curator ->resize(WIDTH, HEIGHT) ->interlace() ->optimize() //not yet implemented ->buildCuration(); $curatedImage = $originalImage->curate('SOME_IDENTIFICATION_KEY', $curation); $curatedImage->setContentGetter(function () use ($curatedImage) { return $this->repository->getContents($curatedImage->getId()); }); $this->repository->persist($curatedImage); } return $curatedImage; }

The imageCurator can be extended or replaced. Also, you can implement another curator alongside the pre-existing one and use both at the same time., (*5)

The only requirement is that the curator should return an array of callbacks that the Curation object can apply to the image., (*6)

The Versions

09/01 2018

dev-master

9999999-dev

File handling library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dario Govergun
by Juan Cruz Falcon

09/01 2018

v1.0.0

1.0.0.0

File handling library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dario Govergun
by Juan Cruz Falcon