Alec Smart
Alec Smart

Reputation: 95900

Rounded Corners

I am wondering whats the best way to programmatically make rounded corners for images. This can be either using PHP or javascript. An algorithm will also do for the same and I can code it with Image::Magick or GD.

Thank you for your time.

Upvotes: 1

Views: 1635

Answers (7)

Paolo Moretti
Paolo Moretti

Reputation: 55956

Use border-radius.

It is supported in IE9+, Firefox 4+, Chrome, Safari 5+, and Opera.

For the best possible browser support, you should prefix with -webkit- and -moz-:

.round {
  /* Safari 3-4, iOS 1-3.2, Android 1.6- */
  -webkit-border-radius: 12px; 

  /* Firefox 1-3.6 */
  -moz-border-radius: 12px; 

  /* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
  border-radius: 12px; 
}

If you need a JavaScript solution for older browsers check out jQuery Corner.

Upvotes: 2

user644602
user644602

Reputation: 44

Another one is the Thumbnailer class.

Upvotes: 0

Salman Arshad
Salman Arshad

Reputation: 272106

Here are links for two PHP based solutions:

  1. Apply rounded corners to images is a PHP script that embeds rounded corner on the image itself
  2. PHP rounded corner generator script generates four corners that you can place over your image using CSS positioning -- or you can use them in your CSS/HTML layouts that require boxes with round corner.

Upvotes: 1

Rony
Rony

Reputation: 9511

use JavaScript to programatically get round corners

OR

you can use mozilla and safaris browser extensions to get round corners using CSS but it will work only in Mozilla and Safari

-moz-border-radius: 5px;
-webkit-border-radius: 5px;

Upvotes: 1

Aduljr
Aduljr

Reputation: 214

You can use the above mention tags with CSS, and for IE, use DDRoundies with some jquery code to make it work in IE. It is what I had to do to get it working. Good example of this is http://swiftmailer.org/ site. they make use of what I mentioned.

Upvotes: 1

Chris Klepeis
Chris Klepeis

Reputation: 9983

I'd use curvy corners or nifty cube

Upvotes: 1

sleske
sleske

Reputation: 83599

Well, it depends what exactly you need. Do you want the corners to be transparent, or filled in some color? Which image format?

Here is some help for making rounded corners: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=8401

Check it out, and if it does not help, update your question with the specific problem. Then we can probably help :-):

Upvotes: 1

Related Questions