承接 crachecode/tajine 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

crachecode/tajine

Composer 安装命令:

composer create-project crachecode/tajine

包简介

image thumbnail generator

README 文档

README

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

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).

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.

Installation

  1. Clone the repository using Git :
    git clone https://github.com/crachecode/tajine.git

  2. Enter the new directory :
    cd tajine

  3. Install dependencies using Composer :
    composer update

  4. Allow writing on the cache directory :
    chmod 777 public/img/cache

  5. Define either the tajine or tajine/public directory as your VirtualHost root.

Using Tajine

Original Images should be placed in tajine/public/img/originals directory.

Images at any dimension can then be accessed via HTTP following this URL syntax :

{name}.{width}x{height}.{method}.{quality}.{upsize}.{extension}

e.g. :

  • 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.

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) :

index.php?filename={name}.{extension}&width={width}&height={height}&method={method}&quality={quality}&upsize={upsize}

e.g. :

  • 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.

统计信息

  • 总下载量: 58
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固