doutiao2540 2019-01-18 02:36
浏览 72
已采纳

GD图像调整大小不适用于生产服务器(Amazon EC2 Ubuntu)

I have two dev environment setup

  1. Test - PHP Version 7.0.33-1+ubuntu16.04.1+deb.sury.org+1 + GD headers Version 2.2.5 (as per phpinfo)
  2. Production - PHP Version 7.0.32-0ubuntu0.16.04.1 + GD headers Version 2.1.1 (as per phpinfo)

on Amazon EC2 Ubuntu in which i am trying to use image resizing with codeigniter image manipulation class with this code.

$resizeConfig['image_library']  = 'gd2';
$resizeConfig['source_image']       = $imageName;
$resizeConfig['new_image']      = $imageName;
$resizeConfig['width']              = 320;
$resizeConfig['height']         = 215;
$resizeConfig['maintain_ratio']    = FALSE;
$resizeConfig['quality']            = '100%';
$this->load->library('image_lib');  
$this->image_lib->initialize($resizeConfig);

both the servers are showing GD installed and enabled if i check on PHPINFO()

The problem is TEST Environment works fine with the code and resizing images on the fly. However, PROD server not working with image resizing with the same code. Install GD on PROD with this command

sudo apt-get install php7.0-gd

Please help me out what i am missing over here. Any help is appreciated. TIA.

  • 写回答

1条回答 默认 最新

  • dqv84329 2019-01-21 00:11
    关注

    The code was not enough for production server. since i am working with codeigniter. I had to add following line.

    $this->image_lib->resize();

    after

    $this->image_lib->initialize($resizeConfig);

    But i still wonder how the same code was working with testing server without that additional line.

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

报告相同问题?

悬赏问题

  • ¥15 加热反应炉PLC控制系统设计(相关搜索:梯形图)
  • ¥15 python 用Dorc包报错,我的写法和网上教的是一样的但是它显示无效参数,是什么问题
  • ¥15 指定IP电脑的访问设置
  • ¥30 matlab ode45 未发现警告,但是运行出错
  • ¥15 vscode platformio
  • ¥15 代写uni代码,app唤醒
  • ¥15 全志t113i启动qt应用程序提示internal error
  • ¥15 ensp可以看看嘛.
  • ¥80 51单片机C语言代码解决单片机为AT89C52是清翔单片机
  • ¥60 优博讯DT50高通安卓11系统刷完机自动进去fastboot模式
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部