eihror/compress-image 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

eihror/compress-image

最新稳定版本:v0.0.6

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

统计信息

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

GitHub 信息

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

其他信息

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