ubuntu php-gd 不支持 imagerotate

Posted 11 months, 1 week ago at 11:32 am. 0 comments

ad 468x60

很麻烦,本来想直接 php gd,难道还要 flash 不成。

以下为引用内容:

安装GD,我也成功了,那些图片函数我也可以用,但有些函数如imagerotate要在绑定的GD库下才能用
你仔细看下phpinfo里面关于GD的信息,其中那个GD Version是bundled (2.0.28 compatible)才是绑定的,如果是2.0 or higher就不是了

As you are probably aware, PHP has bundled an upgraded GD library for some time, which supports image rotation, convolution and alpha blending. The package php5-gd still uses Boutell ’s version of the library, which restricts the abilities of the PHP module.

It would be great if future versions of php5-gd can be built against PHP ’s GD library in order that the GD module can be used to its greatest extent.


via here

这个方法又看不是很懂,源里也没有 libapache2-mod-php5 的源代码。

gd 例子
http://tech.coovol.com/Programming/1189609862

php manual
http://www.php.net/manual/en/function.imagerotate.php

Note: This function is only available if PHP is compiled with the bundled version of the GD library.

有人改写的 imagerotate 函数(只能处理整90度的旋转,其实就是把每个像素的位置换位置)

http://www.php.net/manual/en/function.imagerotate.php#73193

From: https://launchpadlibrarian.net/10644096/php5_5.2.1.orig.tar.gz
To: /home/guoshuang/Desktop/php5_5.2.1.orig.tar.gz
Size: 8.6 MB (9,010,594 bytes)
Transferred: 12 KB (12,288 bytes)

https://launchpad.net/ubuntu/+source/php5/5.2.1-0ubuntu1.5

以下为引用内容:

服务器安装Debian 3.1,PHP5,也装了PHP5-GD的扩展模块。但是却出现这样的错误:Fatal error: Call to undefined function imagerotate()。
首先肯定安装了php的gd模块,而且使用其他gd函数库没有问题,使用get_extension_funcs(”gd”)查看注册的gd函数,果然没有imagerotate函数。imagerotate函数是一个旋转图片的函数,没找到其他可替代的函数。因此想到,可能是Debian的gd模块不对。查看PHP的帮助文档,里面说推荐使用PHP内置的GD库,因为有函数优化方面的考虑。于是想到,可能是因为Debian的PHP5-gd模块没有使用内置的GD库。
使用apt-get source php5-gd,下载了php5的编译源码。找到debian目录下的rule文件,其中–widh-gd=shared,/usr。证实了我最开始的想法。接下来就是重新做一个php5-gd的扩展模块,然后替代它。
制件步骤很简单:
1、修改debian目录下的changelog文件。
2、将debian目录下的rule目录中的–with-gd=shared,/usr改为–with-gd=shared。
3、在php源码的根目录dpkg-buildpackage -rfakeroot 其中会提示安装一些软件包。
4、将生成的php5-gd包解开。dpkg-deb -x php5-gd*.deb test,然后将其中的gd.so替换/usr/lib/php5/…下的gd.so。
5、重启apache。

via Debian下使用PHP GD库的问题

不错的源

http://www.dotdeb.org/mirrors

Popularity: 15% [?]

Tags: , , , , , ,
ad 468x60

No Replies

Feel free to leave a reply using the form below!


Leave a Reply