Skip to content

Instantly share code, notes, and snippets.

@tolew1
tolew1 / gist:4074ce32945277b0fe0db85982a28509
Created May 28, 2016 22:58 — forked from doapp-ryanp/gist:1364489
Manual Imagick crop via gravity
<?php
$this->imgMetadata['format'] = strtolower($this->imagickObj->getImageFormat());
$this->imgMetadata['width'] = $this->imagickObj->getImageWidth();
$this->imgMetadata['height'] = $this->imagickObj->getImageHeight();
$x = $y = 0;
switch ($gravity) {
case 'center':
// $gravity = \Imagick::GRAVITY_CENTER;
$x = ($this->imgMetadata['width']/2) - ($width/2);