https://github.com/yusufshakeel/dyreimage-php
This is an image resizing project.
https://github.com/yusufshakeel/dyreimage-php
image-compression image-processing images php php-gd resize-images
Last synced: 3 months ago
JSON representation
This is an image resizing project.
- Host: GitHub
- URL: https://github.com/yusufshakeel/dyreimage-php
- Owner: yusufshakeel
- License: mit
- Created: 2017-04-18T16:28:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-18T17:24:05.000Z (over 7 years ago)
- Last Synced: 2025-02-05T15:04:39.425Z (11 months ago)
- Topics: image-compression, image-processing, images, php, php-gd, resize-images
- Language: PHP
- Homepage: https://www.dyclassroom.com/dyreimage-php/getting-started
- Size: 1.22 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dyreimage-php
This is an image resizing project.
# Status
[](https://github.com/yusufshakeel/dyreimage-php)
[](https://travis-ci.org/yusufshakeel/dyreimage-php)
[](https://www.npmjs.com/package/dyreimage-php)
[](https://bower.io/search/?q=dyreimage-php)
# Documentation
[Click here for the documentation.](https://www.dyclassroom.com/dyreimage-php/getting-started)
# Getting started
- [Download the latest release.](https://github.com/yusufshakeel/dyreimage-php/releases)
- Clone the repo: `git clone https://github.com/yusufshakeel/dyreimage-php.git`
- Install with [Bower](https://bower.io): `bower install dyreimage-php`
- Install with [npm](https://www.npmjs.com): `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](https://github.com/yusufshakeel/Java-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.
```
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](https://github.com/yusufshakeel/dyreimage-php/blob/master/LICENSE)
Copyright (c) 2017 Yusuf Shakeel
# Buy me a cup of tea
If you enjoy watching my [YouTube](https://www.youtube.com/yusufshakeel) videos and find my projects here on [GitHub](https://github.com/yusufshakeel) interesting and helpful then feel free to buy me a cup of tea or coffee. It helps in creating more :)
[Donate via PayPal](https://paypal.me/yusufshakeel)