views:

1290

answers:

6

Does anyone know how to make a image have rounded corners using a PHP script?

+1  A: 

You will need the GD library for that. There must be a lot of examples on the web. Here is one :

http://www.assemblysys.com/dataServices/php_roundedCorners.php

Theo.T
that is really ugly code
orlandu63
ha, you're right indeed, but it gives an idea ...
Theo.T
A: 

Instead of modifying the image, why not just wrap it in some HTML that has images at each corner that overlay the original to provide the appearance of rounded corners?

By doing the image editing in your .php script, you're going to put undue load on your web server, and that means your application won't scale well.

slacy
A: 

GD is great for image manipulation, but it would be much easier for you and much easier on your server if you used CSS.

Here's a great tutorial for some cool image effects using CSS:

http://www.webdesignerwall.com/tutorials/css-decorative-gallery/

For modern browsers, you can do it in pure CSS:

http://www.css3.info/preview/rounded-border/

A couple of other noteworthy ones:

http://www.spiffycorners.com/

http://www.html.it/articoli/niftycube/index.html

chipotle_warrior
A: 

you can look at http://freelogic.pl/thumbnailer/ . There's a script for creating nice rounded corner thumbs with PHP.

+1  A: 

This script shows how to apply rounded corners to images using PHP and GD Library. It is as simple as drawing four quadrants of a circle over the four corners of the image. The circle itself has to be transparent.

This script, on the other hand, generates rounded corner graphics for HTML or CSS based solutions. It generates the four corners that you can overlay over an image using CSS positioning or HTML tables.

Salman A
A: 

its easy to create some rounded thumbs using php, just use Thumbnailer :)

php rounded corners