doutiao2540 2019-01-18 10: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 08: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 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!