anytizer / cropnail.php
There is no license information available for the latest version (dev-master) of this package.
Cropnail - Ratio maintained thumbnail for any dimensions
dev-master
2023-10-03 05:15 UTC
Requires
- php: >=7.0
- ext-gd: *
This package is auto-updated.
Last update: 2025-03-03 08:23:33 UTC
README
Image thumbnailer that maintains aspect ratio in target image.
- Features cropping an image into any image size
- Tries to include best-fit portion
- Trims off vertical or horizontal sides if target ratio was different
- Source image can be of any size
- Target image can be of any size
Usage
Detailed usages are at: PHP Unit Tests as runner example.
use anytizer\images\cropnail;
$x = 200;
$y = 150;
$cropnail = new cropnail($x, $y);
$cropnail->resize($src_file, $target_file);
Installation
composer require anytizer/cropnail.php:dev-master
Samples
Original Image
cropnail-ed Images
Images | Images |
---|---|
![]() |
![]() |
100 x 100 | 200 x 400 |
![]() |
![]() |
100 x 200 | 400 x 100 |
![]() |
![]() |
100 x 400 | 400 x 200 |
![]() |
![]() |
200 x 100 | 400 x 400 |