PHP GD (intervention/image) : quality is different depending on the server

有些话、适合烂在心里 提交于 2019-12-25 04:26:11

问题


I use the intervention/image library (which use GD) for my Laravel 4.1 project to resize some images (jpg and png). Everything is great on dev server, but in production, the quality of the thumbnails is very poor.

I thought it was a GD problem, but here are the installed versions, and they look similar to me:

dev : OSX Mavericks, php 5.4.19

  • GD Support : enabled
  • GD Version : bundled (2.1.0 compatible)
  • FreeType Support : enabled
  • FreeType Linkage : with freetype
  • FreeType Version : 2.4.10
  • T1Lib Support : enabled
  • GIF Read Support : enabled
  • GIF Create Support : enabled
  • JPEG Support : enabled
  • libJPEG Version : 8
  • PNG Support : enabled
  • libPNG Version : 1.6.2
  • WBMP Support : enabled
  • XBM Support: enabled

prod : Ubuntu 12.04, php 5.4.25

  • GD Support : enabled
  • GD Version : 2.0.36
  • FreeType Support : enabled
  • FreeType Linkage : with freetype
  • FreeType Version : 2.4.8
  • GIF Read Support : enabled
  • GIF Create Support : enabled
  • JPEG Support : enabled
  • libJPEG Version : unknown
  • PNG Support : enabled
  • libPNG Version : 1.2.46
  • WBMP Support : enabled

Am I missing something with those configs? Can somebody figures another problem?

Thanks a lot.

Edit: add code sample:

$image = Image::make(public_path("data/Bandeau/2/picto-sylvestre.png"))->resize(null, 70, true);

And as an example, thumb result on "prod" server is here (source image). On dev server, result is a lot better : example here (ok, I admit "a lot" is a little exaggerated, but on some image it's more obvious, and even on this one look at the thin lines around the eyes).


回答1:


I finally posted this issue at Ask Ubuntu, and it seems that php 5.4 is not compatible with GD 2.1 (@GlennRanders-Pehrson found out there's probably a major algorithm change between 2.0 and 2.1 -- see comments). It's strange, because I've got this config (Php 5.4 and GD 2.1) on my OSX dev machine.



来源:https://stackoverflow.com/questions/21774142/php-gd-intervention-image-quality-is-different-depending-on-the-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!