Home > php教程 > php手册 > body text

提高jpg缩略图质量

WBOY
Release: 2016-06-07 11:41:04
Original
1047 people have browsed it

使用thinkImage时发现jpg的缩率图质量没有预期的好,最后找到对应代码改了一下,现在分享给大家。
使用thinkImage时发现jpg的缩率图质量没有预期的好,最后找到对应代码改了一下,现在分享给大家。
我用的是普通的GD库。
打开thinkphp库里的代码,具体路径如下:
\thinkphp\Extend\Library\ORG\Util\Image\Driver\ImageGd.class.php
大致在100行左右。 //保存图像<br>         if('gif' == $type && !empty($this->gif)){<br>             $this->gif->save($imgname);<br>         } else {<br>             $fun = "image{$type}";<br>         $fun($this->img, $imgname);<br>         }改成: //保存图像<br>         if('gif' == $type && !empty($this->gif)){<br>             $this->gif->save($imgname);<br>         } else {<br>             $fun = "image{$type}";<br>                         if($type=='jpeg'){<br>                 $fun($this->img, $imgname,100);<br>                         }else{<br>                             $fun($this->img, $imgname);<br>                         }<br>         }其实很简单,只是thinkphp对jpeg图像处理采用了系统默认的75质量,这是不够的。
简单改动,小小挫建,如有不当,请指正。

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template