happyproff/kartinki

Simple tool for creating previews of images.

0.0.3 2015-01-26 16:13 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:13:09 UTC


README

Simple tool for creating previews of images.

Latest Stable Version Build Status Scrutinizer Code Quality SensioLabsInsight

Installing

  • Add "happyproff/kartinki": "*" to composer.json.
  • Run composer install

Simple usage example

For example, filename.jpg is 1600x1200.

<?php
use happyproff\Kartinki\Kartinki;

$thumbnails = (new Kartinki)->createImageVersions(
    '/path/to/image/filename.jpg',
    [
        'square' => '200x200',
        'normal' => '400x400:fit',
        'big'    => '1280x720:fit,quality=100',
    ],
    '/output/dir' // optional
);

Kartinki will place 3 files to /output/dir:

1ceebb2cf4b0425a0ea1e1cb49810a07_square.jpg // 200x200
1ceebb2cf4b0425a0ea1e1cb49810a07_normal.jpg // 400x300
1ceebb2cf4b0425a0ea1e1cb49810a07_big.jpg    // 960x720

And $thumbnails will contain:

<?php
[
    'square' => '1ceebb2cf4b0425a0ea1e1cb49810a07_square.jpg',
    'normal' => '1ceebb2cf4b0425a0ea1e1cb49810a07_normal.jpg',
    'big'    => '1ceebb2cf4b0425a0ea1e1cb49810a07_big.jpg'
]