定制 yusufshakeel/dyreimage-php 二次开发

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

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

yusufshakeel/dyreimage-php

Composer 安装命令:

composer require yusufshakeel/dyreimage-php

包简介

This is an image resizing project.

README 文档

README

This is an image resizing project.

Status

license Build Status npm version Bower

Documentation

Click here for the documentation.

Getting started

  • Download the latest release.
  • Clone the repo: git clone https://github.com/yusufshakeel/dyreimage-php.git
  • Install with Bower: bower install dyreimage-php
  • Install with npm: npm install dyreimage-php
  • Install using composer composer require yusufshakeel/dyreimage-php

Requirement

DYReImage requires the following:

  • PHP version 5.5 or higher.
  • GD extension.

Brief history

I was working on an Image Processing Project when I was in college back in 2014. Created this project back then and then decided to make some more changes and put it on GitHub.

What's inside

dyreimage-php/
├── image/
│   └── sample.jpeg
├── src/
│   └── DYReImage/
│       ├── Core/
│       │   ├── Config.php
│       │   ├── Helper.php
│       │   └── Validator.php
│       ├── Utilities/
│       │   ├── Image.php
│       │   └── Resize.php
│       ├── autoload.php
│       └── DYReImage.php
├── tests/
└── index.php

How to use?

Include the DYReImage directory which is inside the src directory in your project. Now to start using it write the following code.

<?php
require_once 'path/to/DYReImage/autoload.php';

// path of source image file that we want to resize
$source = 'path/to/image/sample.jpeg';

// path of destination image file
// resized image will be saved in img directory by the name output.png
$destination = 'path/to/destination/img/output.png';

// options to resize image
// required image width = 400, height 200 (in pixels) and quality = 80
$option = array(
  "height" => 200,
  "width" => 400,
  "quality" => 80
);

// resize
try {
  $obj = new DYReImage\DYReImage($source, $destination, $option);
  $obj->resize();
} catch(\Exception $e) {
  die("Error: " . $e->getMessage());
}
?>

Note! You must have write permission in order to save the resized image in the destination directory.

Create grayscale image

require_once 'path/to/DYReImage/autoload.php';

$source = 'path/to/image/sample.jpg';
$destination = 'path/to/image/output.png';
$option = array(
	"quality" => 80
);

try {
	$obj = new DYReImage\DYReImage($source, $destination, $option);
	$obj->grayscaleImage();
} catch(\Exception $e) {
	die("Error: " . $e->getMessage());
}

Create red image

require_once 'path/to/DYReImage/autoload.php';

$source = 'path/to/image/sample.jpg';
$destination = 'path/to/image/output.png';
$option = array(
	"quality" => 80
);

try {
	$obj = new DYReImage\DYReImage($source, $destination, $option);
	$obj->redImage();
} catch(\Exception $e) {
	die("Error: " . $e->getMessage());
}

Create green image

require_once 'path/to/DYReImage/autoload.php';

$source = 'path/to/image/sample.jpg';
$destination = 'path/to/image/output.png';
$option = array(
	"quality" => 80
);

try {
	$obj = new DYReImage\DYReImage($source, $destination, $option);
	$obj->greenImage();
} catch(\Exception $e) {
	die("Error: " . $e->getMessage());
}

Create blue image

require_once 'path/to/DYReImage/autoload.php';

$source = 'path/to/image/sample.jpg';
$destination = 'path/to/image/output.png';
$option = array(
	"quality" => 80
);

try {
	$obj = new DYReImage\DYReImage($source, $destination, $option);
	$obj->blueImage();
} catch(\Exception $e) {
	die("Error: " . $e->getMessage());
}

License

It's free and released under MIT License Copyright (c) 2017 Yusuf Shakeel

Buy me a cup of tea

If you enjoy watching my YouTube videos and find my projects here on GitHub interesting and helpful then feel free to buy me a cup of tea or coffee. It helps in creating more :)

Donate via PayPal

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固