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 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分