Rounded corners on images using PHP?

后端 未结 7 1800
孤街浪徒
孤街浪徒 2021-01-16 04:23

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

相关标签:
7条回答
  • 2021-01-16 04:45

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

    0 讨论(0)
  • 2021-01-16 04:51

    There are a lot of options available, you can find them using Google. The easiest way though is using the Thumbnailer. It's as simple as two lines of code:

    // make an object
    $th=new Thumbnailer("your-photo.jpg");
    
    // create a 120x90 thumb and round its corners
    $th->thumbFixed(120,90)->round()->save("your-thumb.jpg");
    

    Fun it is, isn't it? :) There are a lot of other options available. The corners will be antialiased.

    0 讨论(0)
  • 2021-01-16 04:54

    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

    0 讨论(0)
  • 2021-01-16 04:55

    You can look at https://www.phpcontext.com/thumbnailer/ . There's a script for creating nice rounded corner thumbs with PHP. They are antialiased too.

    0 讨论(0)
  • 2021-01-16 04:56

    Download easyphpthumbnail.class.php from this link

    from this you can resize and convert image into rounded image.

    in below example image is converted into transparent circle image.

    include_once('easyphpthumbnail.class.php');
    $source = 'demo.jpg';
    $width      =  100;
    $height     =  100;    
    $thumb = new easyphpthumbnail;
    $thumb -> Thumbheight = $width;
    $thumb -> Thumbwidth = $height;
    $thumb -> Backgroundcolor = '#FFFFFF';
    $thumb -> Clipcorner = array(2,50,0,1,1,1,1);
    $thumb -> Maketransparent = array(1,0,'#FFFFFF',10);   
    $thumb -> Createthumb($source);
    
    0 讨论(0)
  • 2021-01-16 05:00

    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.

    0 讨论(0)
提交回复
热议问题