doudou5101 2015-06-24 12:53
浏览 6
已采纳

如何在PHP中创建图像缩放器?

I want to resize image to a fixed dimension(say 180 X 180) .No matter what the size of user input image is,I want the resized one to be stored in database and retreived later.

Is there any library/function available in PHP for the same ?

  • 写回答

1条回答 默认 最新

  • dongqu9917 2015-06-24 13:09
    关注

    I'd suggest looking into Intervention image if you don't wanna write anything yourself. It can use both GD or ImageMagick and has many built in functions that allow solving most of the trivial image problems with several lines of code.

    As simple as that:

    $img = Image::make('yourimage.jpg')
    $img->resize(180, 180);
    

    And then use either save or encode method based on your needs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中
  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信
  • ¥30 Python调用dll文件输出Nan重置dll状态
  • ¥15 浮动div的高度控制问题。
  • ¥66 换电脑后应用程序报错
  • ¥50 array数据同步问题