1

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).

Laurence
  • 58,936
  • 21
  • 171
  • 212
Philippe
  • 668
  • 8
  • 17
  • Can you narrow it down to a small bit of code that reproduces the problem? – Matt Gibson Feb 14 '14 at 08:42
  • @MattGibson of course: added in the post text. – Philippe Feb 14 '14 at 10:36
  • _“and they look similar to me”_ – well if “similar” is the criterion by which you are trying to access this, then I’d say your images are probably “similar” as well, end of problem. Otherwise, you should acknowledge that _“GD Version : bundled (2.1.0 compatible)”_ vs _“GD Version : 2.0.36”_ and _“libPNG Version : 1.6.2”_ vs _“libPNG Version : 1.2.46”_ might be _quite different_ and not very “similar” at all … – CBroe Feb 14 '14 at 12:00
  • @CBroe Well, excuse my great ignorance; note that I admit it the first time, writing "they look similar **to me**". I meant GD seems up-to-date (at least, nothing more came up with a apt-get install php5-gd), and that the difference of quality (which is quite important) seems too big (IMO) to be the result of a minor version change. But I can be wrong! I'll try to figure a way to install GD 2.1 on my ubuntu prod server, to see. – Philippe Feb 14 '14 at 12:24
  • @Philippe, could you also post the "dev" thumbnail? – Glenn Randers-Pehrson Feb 14 '14 at 16:35
  • @GlennRanders-Pehrson of course: I added it at the end of the post. – Philippe Feb 15 '14 at 19:50
  • When I displayed the images against a white background I could not tell the difference. But then when displaying them against a mid-gray background the "dev" version is much better looking than the "prod" one. – Glenn Randers-Pehrson Feb 16 '14 at 03:59
  • It seems that the "dev" image consists of all black foreground colors with varying amounts of alpha, while the "prod" image contains about 4 different levels of gray in the foreground, with varying alphas. Displayed against a black background, the original and "dev" are both completely black, while the "prod" image shows some clutter. I guess there has been a major algorithm change. – Glenn Randers-Pehrson Feb 16 '14 at 04:05
  • @GlennRanders-Pehrson OK, so you also think I have to find a way to update the GD library on the prod server, that's it? I'll look, but there it seems there's no more recent stable version of GD for my Ubuntu 12.04 server... Thanks al lot, anyway! – Philippe Feb 16 '14 at 08:18

1 Answers1

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.

Community
  • 1
  • 1
Philippe
  • 668
  • 8
  • 17