I am uploading a normal image to server and storing path in database.Now,My question here, I want to create a round image in php. that is ,I want to convert this normal picture to round(wheel type or circle) image dynamically .How can i do this in php? is it possible to do in GD.How can i convert normal(square) picture to circle image dynamically from the server
I think your picture will always be square; all you can do is overlay a mask or something to make it seem round.
<?php
// Create the mask - in this case a circle but could be any shape, make sure the mask is large enough to cover the whole image
exec("/usr/local/bin/convert -size 200x200 xc:none -fill blue -draw 'circle 100,100 100,13' circle.png");
// Use the mask to remove everything apart from the circle move the mask where you want with -geometry +0+0
exec("/usr/local/bin/composite -compose Dst_Out circle.png -geometry +0+0 image.jpg -matte new_image.png");
unlink("circle.png");
?>
Imagemagick method, from memory the background should be transparent; may need to make it a gif instead of png but you will get a colour if you save as jpg. I would guess if you want to save as a jpg you would need to change xc:none to your page background colour.
Imagemagick is free but depends if your host has it installed; it can deal with most image formats without setting different codes for different types. The other major image manipulating software is GD library; which I do not know so much about.
Put this code onto a page and run on your server to see if you have ImageMagick installed: