Created
February 6, 2019 12:02
-
-
Save mirdic/8777936d6d10526e6b923b2f1ce69cab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$im = imagecreatefrompng('alphatest.png'); | |
$size = min(imagesx($im), imagesy($im)); | |
$im2 = imagecrop($im, ['x' => 0, 'y' => 0, 'width' => $size, 'height' => $size]); | |
if ($im2 !== FALSE) { | |
imagepng($im2, 'example-cropped.png'); | |
imagedestroy($im2); | |
} | |
imagedestroy($im); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment