定制 kisphp/thumbnails 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

kisphp/thumbnails

最新稳定版本:1.6.1

Composer 安装命令:

composer require kisphp/thumbnails

包简介

Kisphp thumbnails generator. Supports jpg, png, gif, webp images

README 文档

README

pipeline status coverage report

Latest Stable Version Total Downloads License Monthly Downloads

This class will help you to easily resize images and save them to disc or show them to user

Supported format:

  • jpg
  • jpg2000
  • png
  • gif
  • webp

Installation

composer require kisphp/thumbnails

Then add make sure you load composer autoloader:

require_once 'path/to/vendor/autoload.php';

Usage

<?php

require_once 'path/to/vendor/autoload.php';

$image = new \Kisphp\ImageResizer();

// load original image file
$image->load('/path/to/image/file.jpg');

// set where thumbnail will be saved (optional)
$image->setTarget('/path/to/thumbnail/file.jpg');

// resize image to a 300px width and dynamic height by aspect ratio 
$image->resize(300, 0);

// or
// resize image to a 300px height and dynamic width by aspect ratio 
$image->resize(0, 300);

// show image and save
$image->display(true);

Change thumbnail background color

If you crop the images, you can use a custom background color to integrate the thumbnail into your design

// set default background color (here will be red, default is white)
$image->setBackgroundColor(255, 0, 0);

Resize method usage

$image->resize(new_width, new_height, crop_image=true|false);

Show image without saving it

$image->display();

Note that these methods outputs header('Content-Type: image/..mime-type..')

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-11