定制 eihror/compress-image 二次开发

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

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

eihror/compress-image

Composer 安装命令:

composer require eihror/compress-image

包简介

Compress your image without losing quality

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Compress Image

Compress your image without losing quality

How to use

Clone this project inside the project that you want to use

composer require eihror/compress-image

Create variables to receive the elements

$file = 'koala.jpg'; //file that you wanna compress
$new_name_image = 'koala_mini'; //name of new file compressed
$quality = 60; // Value that I chose
$pngQuality = 9; // Exclusive for PNG files
$destination = 'content'; //This destination must be exist on your project
$maxsize = 5245330; //Set maximum image size in bytes. if no value given 5mb by default.

The quality works only for JPG�s images. But if you want to change the file to PNG�s, you have to change manually via code. GIF doesn't affect the quality

Default quality for PNG: 9 ( 0 - no compression, 9 - max compression ) Create a new instance of a class

$image_compress = new Eihror\Compress\Compress($file, $new_name_image, $quality, $pngQuality, $destination, $maxsize);

And make the compression calling the function compress_image

$image_compress->compress_image();

This function will return only the name of new image compressed with your respective extension

That´s it! Feel free to use and making the code better if you find something different or wrong

统计信息

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

GitHub 信息

  • Stars: 33
  • Watchers: 4
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固