Rounded corners on images using PHP?

后端 未结 7 1799
孤街浪徒
孤街浪徒 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: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.

提交回复
热议问题