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
please help me?
Thanks & Regards to all
I think your picture will always be square; all you can do is overlay a mask or something to make it seem round.
// 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");
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.
Thanks,I am uploading square images,then i want to convert.but uploading both gif and jpeg.
I haven't used image magic.is it free ?can i use commercially?
is it possible to create the circle without using image magic ?
God knows what I have done but the PC has gone mad doing things I do not want it to do !
I hit the Ctrl key and another one and now can get out of whatever is happening.
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:
system("exec 2>&1; type convert");
// Output: convert is /usr/local/bin/convert
system("exec 2>&1; convert -version");
// Output: Version: ImageMagick 6.2.8 06/10/06 Q16 http://www.imagemagick.org
// Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
It should display the info but may ask you to download a file which will contain the info.
A round image created with a different ImageMagick method -
This topic is now closed. New replies are no longer allowed.