Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexantr/image-resize
Image resizing library
https://github.com/alexantr/image-resize
crop gd image-processing images imagick php thumbnails
Last synced: 2 months ago
JSON representation
Image resizing library
- Host: GitHub
- URL: https://github.com/alexantr/image-resize
- Owner: alexantr
- License: mit
- Created: 2015-10-17T16:08:34.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-11T14:42:09.000Z (about 2 years ago)
- Last Synced: 2024-11-08T21:46:09.264Z (3 months ago)
- Topics: crop, gd, image-processing, images, imagick, php, thumbnails
- Language: PHP
- Homepage:
- Size: 1.07 MB
- Stars: 3
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ImageResize
Image resizing library. Creates images on demand using GD.
## Install
Install through [Composer](http://getcomposer.org/):
```
composer require alexantr/image-resize
```## Examples
See full list of examples in `example` folder.
Creating URLs:
```php
use Alexantr\ImageResize\Image;$src1 = Image::init('uploads/pic.jpg')->crop(200, 200);
$src2 = Image::init('uploads/pic.jpg')->silhouette()->quality(95)->fit(200, 200);
$src3 = Image::init('uploads/pic.jpg')->fitWidth(200);
$src4 = Image::init('uploads/pic.jpg')->fitHeight(200);
$src5 = Image::init('/site/uploads/pic.jpg')->bgColor('6af')->fill(200, 200);
```Can use class member access on instantiation in PHP 5.4 or higher:
```
```## Creator example
Apache `.htacces` file:
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^resized/(.*)$ image.php?path=$1 [L]
````image.php` in web root folder:
```php
require '../vendor/autoload.php';$webroot = __DIR__;
$path = isset($_GET['path']) ? $_GET['path'] : '';Alexantr\ImageResize\Creator::create($webroot, $path);
```