承接 peterujah/nano-image 相关项目开发

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

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

peterujah/nano-image

Composer 安装命令:

composer require peterujah/nano-image

包简介

NanoImage is a simple php image resize class.

README 文档

README

NanoImage is a simple PHP image resize class. It can resize images and display them in the browser or save images in a directory

Installation

Installation is super-easy via Composer:

composer require peterujah/nano-image

Basic Usage

$image = new NanoImage();
try{
  $image = $imagine->open("path/to/save/edit-image-size.jpg");

  $image->resize(360, 200, false);
  $image->save("path/to/save/new-image.jpg", NanoImage::THUMBNAIL, 80);

  $image->resize(116, 80, false);
  $image->saveAs("path/to/save/new-image.jpeg", NanoImage::THUMBNAIL, 100, NanoImage::JPEG);

  $image->free();
}catch(UnsupportedImageException $e){
  echo $e->getMessage();
}

Applying Filters

$image = new NanoImage();
$image->filter(IMG_FILTER_GRAYSCALE)
      ->filter(IMG_FILTER_BRIGHTNESS, 30)
      ->get(90);

Or:

$image->filters([
    [IMG_FILTER_CONTRAST, -50],
    [IMG_FILTER_COLORIZE, 100, 50, 0], // Add color overlay
])->get();
$img = new Peterujah\NanoBlock\NanoImage();

Initialize nano image class for use

Open and load any image from a directory path & file name

$img->open(__DIR__ . "/path/to/assets/image.jpg");

Or load string containing the image data.

$img->load($image_data);

Resize an image with the exact width and height passed, for example, 200x200. To resize an image using the aspect ratio set the third parameter to true

$img->resize(200, 200, false||true);

Blur image

$img->blur(20);

Once image manipulation is done, display the output image on the browser. Pass quality of the image

$img->display($quality);

Save an image to a directory, the first parameter specifies the path, the second sets the image naming option, and the third is image quality (90 by default)

$img->save(__DIR__ . "/path/to/assets/new-image.jpg", NanoImage::DEFAULT, $quality);

Save image as

$img->saveAs($to,  NanoImage::DEFAULT || NanoImage::THUMBNAIL || NanoImage::TIMESTAMP, $quality, self::JPEG)

Replace the existing image with a new one

$img->replace($to, $quality)

Remove temp image after editing and free memory

$img->remove()

Free memory

$img->free()

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固