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

This package is auto-updated.

Last update: 2024-06-03 06:50:56 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

Original Image

cropnail-ed Images

Images Images
Screenshot Screenshot
100 x 100 200 x 400
Screenshot Screenshot
100 x 200 400 x 100
Screenshot Screenshot
100 x 400 400 x 200
Screenshot Screenshot
200 x 100 400 x 400