edwin-luijten/intervention-image-focus

Intervention Image filter to crop images with a focal point

1.0.0 2021-12-19 11:14 UTC

This package is auto-updated.

Last update: 2024-10-19 18:40:46 UTC


README

Packagist Downloads CircleCI Code Climate maintainability

Example

Cropping images based on a focal point.

Requirements

Installation

composer require edwin-luijten/intervention-image-focus

Usage

use Intervention\Image\ImageManager;
use EdwinLuijten\InterventionImageFocus\FocusFilter;

$manager = new ImageManager();
$image = $manager->make('foo.png');

// x-y percentage
$image->filter(new FocusFilter(500, 500, '75-50')));

$image->encode('png');
$image->save('test.png');

Image attribution:
Title: Sunset city skyline
Author: Kevin Young @ Unsplash
Source: https://unsplash.com/photos/-icmOdYWXuQ