2017 © Pedro Peláez
 

library cropbuddy

Smart cropping images with PHP

image

rych/cropbuddy

Smart cropping images with PHP

  • Thursday, April 10, 2014
  • by rchouinard
  • Repository
  • 1 Watchers
  • 3 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CropBuddy

Another quick project written as part of a larger one. This library takes an Imagick object and crops the image using a given cropping strategy., (*1)

How does it work?

CropBuddy modifies your Imagick objects in place. It can resize and/or crop images to given dimensions., (*2)

Included strategies are:, (*3)

  • CenterStrategy - the default, just ccrops from image center
  • EntropyStrategy - crops to the most interesting part of an image (I make no promises as to how interesting the chosen bit really is)

Usage

<?php

$strategy = new \Rych\CropBuddy\Strategy\EntropyStrategy();
$cb = new \Rych\CropBuddy\CropBuddy($myImagickObject, $strategy);

// Resize the image to either a height or width of 150px
// A 600x300 image will end up at 300x150
$cb->resize(150, 150);

// Square the image to 150x150
$cb->crop(150, 150);

Installation

Composer:, (*4)

composer require rych/cropbuddy:dev-master@dev

To-do

Add more strategies and write unit tests., (*5)

The Versions

10/04 2014

dev-master

9999999-dev

Smart cropping images with PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-imagick *