定制 masum-nishat/image-resize-php 二次开发

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

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

masum-nishat/image-resize-php

Composer 安装命令:

composer require masum-nishat/image-resize-php

包简介

Resize image to desire file size by only one compression

README 文档

README

PHP library to resize image to desire file size by only one compression.

Warning

This is a development package. I encourage not to use in production environment.

Please inform if any bug or security issue or any other problem found.

Any suggestion will be taken seriously.

Setup

This package is available through Packagist with the vendor and package identifier the same as this repo.

If using Composer, run following command:

composer require "masum-nishat/image-resize-php":"^1.1.0"

Note: This library uses GD class which do not support resizing animated gif files

Resize

Only supported resizing param is according to file size. Image dimension will be changed and final image will be under 250KB (Default).

imageResize::convert('image.jpg', 'image-converted.jpg');
//or
imageResize::convert('image.png', 'image-converted.png');

Let the extension detect automatically from mime type:

imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');

Declare required maximum size:

imageResize::$targetSize = 300000; //maximum 300KB

imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');

This class creat unique temp directory and delete it after using. To use custom temp directory and not delete temp components (useful for debugging):

imageResize::$tempDir = 'path/to/temp/folder';

imageResize::convert('image.jpg', 'image-converted');
//or
imageResize::convert('image.png', 'image-converted');

Supported Image Types

  • IMAGETYPE_JPEG
  • IMAGETYPE_PNG
  • IMAGETYPE_GIF

Quality

Maximum quality is selected by default.

Quality change param is not implemented yet;

Exceptions

Exception handling not implemented yet.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-11-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固