jsalita Posted April 8, 2008 Share Posted April 8, 2008 I need to be able to automatically round the corners of any image my script loads. The best way I can think of doing this is to superimpose the corners when the image loads but I don't know if that can be done and how. Any help would be appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/ Share on other sites More sharing options...
cooldude832 Posted April 8, 2008 Share Posted April 8, 2008 what you want to do is find the corners getimagesize will do this for you. Create a 1x1 pixel (or larger) transparent .png to use as an over lay Figure out the correct corner in proportion to the image size for each corner and then make it a triangle shape to start. get the cordinates of each point on the triangle. Change the hypotenuses of the triangle into a cubic equation (or polar circle) that will "round" the hypotenuses of the triangle. Then once you know which pixels need to get "transparented" either use you 1x1 pixel image on each "square" about 60 times or develop a larger say 4x4 transparent box in addition to the 1x1 and simply "white it out" like a pen stroke. That is my simple idea to do it, odds are there is a better way where you create initially a a transparent image of the original image size and then overlay the original on top of it with its corners "rounded" however I find this version workable in my mind. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511734 Share on other sites More sharing options...
jsalita Posted April 8, 2008 Author Share Posted April 8, 2008 How do I overlay another image on top of the original? Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511752 Share on other sites More sharing options...
cooldude832 Posted April 8, 2008 Share Posted April 8, 2008 look up the gd library it has a function allowing an image to be a background for a new image and then placing images on top. a watermark tutorial could help you Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511919 Share on other sites More sharing options...
JasonLewis Posted April 8, 2008 Share Posted April 8, 2008 Isn't this possible with CSS? I'm pretty sure it is. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511926 Share on other sites More sharing options...
cooldude832 Posted April 8, 2008 Share Posted April 8, 2008 Isn't this possible with CSS? I'm pretty sure it is. not if you want the physical image to have corners in it instead of using css to mask it. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511927 Share on other sites More sharing options...
JasonLewis Posted April 8, 2008 Share Posted April 8, 2008 Isn't this possible with CSS? I'm pretty sure it is. not if you want the physical image to have corners in it instead of using css to mask it. Oh ok. Yeah I just did a quick search and couldn't turn up much. Maybe I was thinking of something else. Stick with using GD and play around with some of the functions it offers. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-511933 Share on other sites More sharing options...
jsalita Posted April 9, 2008 Author Share Posted April 9, 2008 Okay, thanks. Link to comment https://forums.phpfreaks.com/topic/100077-rounding-image-corners/#findComment-512596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.