PHP GD(干预/图像):质量因服务器而异 [英] PHP GD (intervention/image) : quality is different depending on the server

查看:172
本文介绍了PHP GD(干预/图像):质量因服务器而异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用干预/图片库(使用GD)为我的Laravel 4.1项目调整大小图像(jpg和png)。开发服务器上的一切都很棒,但在生产中,缩略图的质量非常差。

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.

我认为这是一个GD问题,但这里是已安装的版本,它们看起来和我类似:

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


  • GD支持:启用

  • GD版本:捆绑(2.1.0兼容)

  • FreeType支持:已启用

  • FreeType链接:使用freetype

  • FreeType版本:2.4.10

  • T1Lib支持:已启用

  • GIF阅读支持:已启用

  • GIF创建支持:已启用

  • JPEG支持:已启用

  • libJPEG版本:8

  • PNG支持:已启用

  • libPNG版本:1.6.2

  • WBMP支持:已启用

  • XBM支持:已启用

  • 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

  • GD支持:已启用

  • GD版本:2.0.36

  • FRE eType支持:已启用

  • FreeType链接:使用freetype

  • FreeType版本:2.4.8

  • GIF阅读支持:已启用

  • GIF创建支持:已启用

  • JPEG支持:已启用

  • libJPEG版本:未知

  • PNG支持:已启用

  • libPNG版本:1.2.46

  • WBMP支持:已启用

  • 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?

非常感谢。

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

作为示例,拇指结果在prod服务器上在这里源图像)。在开发服务器上,结果要好得多:此处的示例(好吧,我承认很多有点夸张,但在某些图像上它更明显,甚至在这一眼看到眼睛周围的细线)。

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

推荐答案

我终于将此问题发布在询问Ubuntu ,似乎php 5.4与GD 2.1不兼容(@ GlennRanders-Pehrson发现可能在2.0和2.1之间有一个重大的算法变化 - 见评论)。这很奇怪,因为我的OSX开发机器上有这个配置(Php 5.4和GD 2.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.

这篇关于PHP GD(干预/图像):质量因服务器而异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆