2017 © Pedro PelĂĄez
 

project tajine

image thumbnail generator

image

crachecode/tajine

image thumbnail generator

  • Thursday, November 9, 2017
  • by crachecode
  • Repository
  • 1 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Tajine

Tajine is an images and thumbnails generator suitable for any web project. It is based on the Intervention Image library., (*1)

Features

Tajine allows you to resize images at any dimensions, in a flexible way, and cache the generated images. These images can be called directly at a specific size via HTTP by passing parameters in the URL. This URL can be used in a HTML file as the src parameter of an img tag e.g. (or by a CSS rule-set)., (*2)

Requirements

Tajine requires PHP 5.6 or higher. Its cache functionality can make use of Apache mod_rewrite, it also allows simpler image URLs, but Apache should not be mandatory. Tajine has not been tested with any other HTTP server though., (*3)

Installation

  1. Clone the repository using Git :
    git clone https://github.com/crachecode/tajine.git, (*4)

  2. Enter the new directory :
    cd tajine, (*5)

  3. Install dependencies using Composer :
    composer update, (*6)

  4. Allow writing on the cache directory :
    chmod 777 public/img/cache, (*7)

  5. Define either the tajine or tajine/public directory as your VirtualHost root., (*8)

Using Tajine

Original Images should be placed in tajine/public/img/originals directory., (*9)

Images at any dimension can then be accessed via HTTP following this URL syntax :, (*10)

{name}.{width}x{height}.{method}.{quality}.{upsize}.{extension}, (*11)

e.g. :, (*12)

  • image.1280x1024.basic.90.false.jpg (width = 1280px, height = 1024px, basic method, jpg quality 90, no upsizing)
  • image.1280x.false.jpg (width = 1280px, no height specified, no upsizing)
  • image.x1024.jpg (height = 1024px, no width specified)

Parameters

name value type description default
name string filename as accessible in tajine/public/img/originals without extension n/a, required
extension string extension of filename as accessible in tajine/public/img/originals n/a, required
width integer thumbnail width (in pixel) n/a
height integer thumbnail height (in pixel) n/a
method basic, fit or max resizing behaviour, see next paragraph fit
quality integer, 0 to 100 thumbnail quality, bigger is better but files are heavier 85
upsize boolean whether or not small images should be enlarged with larger thumbnail size true
subdir boolean create a subdirectory for each image true

Method can be set to : * basic : image will be resized to the exact dimension, without keeping aspect ratio. * fit : image will be resized to fit in specified width and / or height, keeping aspect ratio.
If only one dimension is specified, unspecified dimension (width or height) will be adjusted depending on the other dimension.
If both are specified, image will be cropped if necessary. * max : image will be resized to fit in specified width and / or height, keeping aspect ratio, without cropping., (*13)

Without mod_rewrite

You should still be able to use Tajine without mod_rewrite or with a HTTP server other than Apache. However the images URLs to call would be a bit different (and not so nice) :, (*14)

index.php?filename={name}.{extension}&width={width}&height={height}&method={method}&quality={quality}&upsize={upsize}, (*15)

e.g. :, (*16)

  • index.php?filename=image.jpg&width=1280&height=1024&method=basic&quality=90&upsize=false
  • index.php?filename=image.jpg&height=1024

Notes

Generated thumbnails are saved as image files in tajine/public/img/cache directory.
When using mod_rewrite these files names are the same string as the URL provided for images generation. Therefore Apache doesn't even need to process PHP to display the cached version.
They can safely be deleted to process the generation again., (*17)

The Versions

09/11 2017

dev-master

9999999-dev https://github.com/crachecode/tajine

image thumbnail generator

  Sources   Download

MIT

The Requires

 

cache image resize

07/11 2017

v1.0.1

1.0.1.0 https://github.com/crachecode/tajine

image thumbnail generator

  Sources   Download

MIT

The Requires

 

cache image resize

07/11 2017

v1.0.0

1.0.0.0 https://github.com/crachecode/tajine

image thumbnail generator

  Sources   Download

MIT

The Requires

 

cache image resize