Reputation: 77
When a user upload an avatar for himself, I want to convert it into a circular image and then save it, as circular looks much more prettier when displaying in the page.
How can I do that in a simple way, as mine is a small application. I have read about ImageMagick, but thats an option right now.
I read about masking or using another image as mask to do that.
Any simple method or way to do this. Thanxx in advance!!!
Upvotes: 1
Views: 252
Reputation: 4398
The same as said before, the best option is store the image 'as is' and then apply rounded styles with css (this way you always have the original image).
But if it not work for you, you could use this: https://adamcod.es/2012/07/25/imagine-php-image-library.html && Crop image in circle (php)
Using imageMagik is this simple:
convert -size 200x200 xc:none -fill walter.jpg -draw "circle 100,100 100,1" circle_thumb.png
circularize an image with imagick
Upvotes: 1