2017 © Pedro Peláez
 

library images

Image storage for Nette Framework

image

brabijan/images

Image storage for Nette Framework

  • Saturday, June 2, 2018
  • by brabijan
  • Repository
  • 5 Watchers
  • 53 Stars
  • 12,902 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 12 Forks
  • 2 Open issues
  • 5 Versions
  • 3 % Grown

The README.md

Images

Join the chat at https://gitter.im/brabijan/images, (*1)

This is a simple image storage for Nette Framework, (*2)

Instalation

The best way to install brabijan/images is using Composer:, (*3)

$ composer require brabijan/images:@dev

Then you have to register extension in config.neon., (*4)

extensions:
    - Brabijan\Images\DI\ImagesExtension

Package contains trait, which you will have to use in class, where you want to use image storage. This works only for PHP 5.4+, for older version you can simply copy trait content and paste it into class where you want to use it., (*5)

<?php

class BasePresenter extends Nette\Application\UI\Presenter {

    use Brabijan\Images\TImagePipe;

}

Usage

Saving images

/** @var Brabijan\Images\ImageStorage $imageStorage */
$imageStorage->upload($fileUpload); // saves to .../assetsDir/original/filename.jpg

$imageStorage->setNamespace("products")->upload($fileUpload); // saves to .../assetsDir/products/original/filename.jpg

Using in Latte

<a href="{img products/filename.jpg}"><img n:img="filename.jpg, 200x200, fill"></a>

output:, (*6)

<a href="/assetsDir/products/original/filename.jpg"><img src="/assetsDir/200x200_4/filename.jpg"></a>

Using in Texy!

First you have to register macro into Texy!, (*7)

$texy = new Texy;
$this->registerTexyMacros($texy);

Now you can just use it. Macro expands native image macro in Texy. Here is the syntax., (*8)

[* products/filename.jpg, 200x200, fill *]

If file not found in image storage, macro try to search file in document root. Of course you can add title or floating of image, as you know from pure Texy!, (*9)

Resizing flags

For resizing (third argument) you can use these keywords - fit, fill, exact, stretch, shrink_only. For details see comments above these constants, (*10)

The Versions

02/06 2018

dev-master

9999999-dev

Image storage for Nette Framework

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

The Development Requires

by Jan Brabec

nette images

02/06 2018

v3.0.0

3.0.0.0

Image storage for Nette Framework

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

by Jan Brabec

nette images

01/11 2016

v2.0.0

2.0.0.0

Image storage for Nette Framework

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

The Development Requires

by Jan Brabec

nette images

16/11 2015

v1.0.0

1.0.0.0

Image storage for Nette Framework

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

The Development Requires

by Jan Brabec

nette images

11/08 2015

dev-nette-2.1

dev-nette-2.1

Image storage for Nette Framework

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

The Development Requires

by Jan Brabec

nette images