定制 zepekegno/resize-image 二次开发

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

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

zepekegno/resize-image

最新稳定版本:1.0

Composer 安装命令:

composer require zepekegno/resize-image

包简介

Resize an image and convert into another format. driver use is GD

README 文档

README

example branch parameter Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

This Library will help you to convert easily and image into other format. this library use GD driver. PHP version supported *8 What we can do with this library ?

  • We can convert an image into another format.
  • We can resize an image to another format.
  • We can convert and resize an image to another format simultaneously.

Format supported for resizing : PNG, JPEG, JPG, GIF Format supported for conversion : PNG, JPEG, JPG

//Resize an image

// Example with png
$source = 'image.png';

$resizeImage = new zepekegno\Resize($source,50,50);


/**
 * If file exist a copy of this file will be created with suffix cpr
*/
$resizeImage->make(target:'tmp/final',quality:9);

//if delete is true will delete this file and create a new file
$resizeImage->make(target:'tmp/final',quality:9,delete:true);

// Example with Gif

$source = 'image.gif';

$resizeImage = new zepekegno\Resize($source,50,50);

/**
 * If file exist a copy of this file will be created with suffix cpr
*/
$resizeImage->make('tmp/final');

//if delete is true will delete this file and create a new file
$resizeImage->make(target:'tmp/final',delete:true);

//Convert an image to other format 
/**
 * convert image png to jpeg
 * Return the path of image
*/
$source = 'image.png';
$convertImage = new zepekegno\Resize(source:$source,height:50,width:50);
$convertImage->convert(type:'jpeg',target:'tmp/final',quality:100,isResizable:false);

/**
 * Convert png to jpeg and resize it
 * if we want to resize, past isResizable to true
 * Return the path of image
*/
$source = 'image.png';
$convertImage = new zepekegno\Resize(source:$source,height:50,width:50);
$img = $convertImage->convert(type:'jpeg',target:'tmp/final',quality:100,isResizable:true);

// Generate image
$image = "<img src=\"{$img}\"/>";

ResizeImage are constructed with this parameters

  • $source string, the filename

  • $width int, the new width of the file

  • $height int, the new height of the file

The make method which needs the following parameters

  • $target string, the directory where the file will be store

  • $quality int, the quality of the image will be use for png [0-9], jpeg or png [0-100], gif are not need

  • $delete *bool, Optional, true delete the file if exist else it will be copied into a new file prepend with *cpr

The convert method which needs the following parameters

  • $type string, the format would be convert the image

  • $target string, the directory where the file will be store

  • $quality int, the quality of the image will be use for png [0-9], jpeg or png [0-100], gif are not need

  • $isResizable bool, Optional, true convert and resize the image, false convert only the image

The support conversion for Gif is'nt available

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固