happyproff/kartinki

用于创建图片预览的简单工具。

维护者

详细信息

github.com/happyproff/kartinki

源代码

安装: 170

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 2

分支: 1

0.0.3 2015-01-26 16:13 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:24:11 UTC


README

用于创建图片预览的简单工具。

Latest Stable Version Build Status Scrutinizer Code Quality SensioLabsInsight

安装

  • "happyproff/kartinki": "*"添加到composer.json
  • 运行composer install

简单用法示例

例如,filename.jpg是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会将3个文件放置到/output/dir目录下

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

并且$thumbnails将包含

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