承接 kennynguyeenx/image-service 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

kennynguyeenx/image-service

Composer 安装命令:

composer require kennynguyeenx/image-service

包简介

Provide some functions to convert images.

README 文档

README

Provide some functions to manipulate images

Features

  • Resize image
  • Set background color for image
  • Create bigger image with old image in the center
  • Convert image to the other type
  • Dependencies: imagemagick, webp
  • PSR-4 compatible.
  • Compatible with PHP >= PHP 7.

Installation

  • You can download image-service through https://github.com/kennynguyeenx/image-service.

  • image-service requires the Multibyte String extension and the Imagick extension from PHP.

  • Typically you can use the configure option --enable-mbstring while compiling PHP to have the Multibyte String extension. More information can be found in the PHP documentation.

  • Imagick is a native php extension to create and modify images using the ImageMagick API. More information can be found in the PHP documentation.

Usage

  • Resize image:
use Kennynguyeenx\ImageService\ImageService;

try {
    $imageService = new ImageService();
    $imageService->manipulateImage($imageUrl, $options, $outputImagePath, $outputFormat);
} catch (Exception $exception) {
    exit($exception->getMessage());
}
  • $options should consist these keys: width (width of new image), height (height of new image), background (background color of new image if using canvas)

  • I created a file to run in console to manipulate images as an example of using this class

  • It's located at bin directory with name manipulate_image.php

  • You can follow these steps to resize and convert image to the other type:

  1. Save a image under the folder that you want. For me, i save it under images/source folder as example_image.png

Background Image URL

  1. This image have size is 300x300. We will try to resize it to 200x200 and convert it from png to gif. We can run this command:
$ php ./bin/manipulate_image.php ./images/source/example_image.png 200x200_ ./images/destination/updated_image.png gif
  1. This is the result:

An example stickerset

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固