Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP GD - Crop Shape

Tags:

php

crop

gd

I want to crop images using the GD, but I want it to crop around a particular shape rather than just a square.

Is this possible?

like image 737
Ben Shelock Avatar asked Nov 06 '22 19:11

Ben Shelock


1 Answers

One way to do it would be to create a mask in the desired square size, containing a alpha channel that is transparent. And then laying it over the original image, that way you would be able to crop a circle.

like image 83
D_V Avatar answered Nov 12 '22 17:11

D_V