用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4342|回复: 7
收起左侧

linux下图片不能旋转以及图片变成黑白色

[复制链接]
发表于 2008-9-11 11:51:56 | 显示全部楼层 |阅读模式
我在windows下的使用完全正常。
可在LINUX下遇到里以下问题:  使用image_lib在LINUX下不能旋转。 并且经过处理后(放大或缩小等剪切的动作后),图片自动变成了黑白色,
找了好久的原因仍没有找出来, 我用的是gd2.0.35。即最新版本。
gd库支持信息如下:
gd
GD Support enabled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.9
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled


LINUX系统也已安装了gd相关包。
请问下如何解决?  在线等待...
发表于 2008-9-11 12:06:37 | 显示全部楼层
你的 CI 代码是什么样的?
 楼主| 发表于 2008-9-11 12:48:49 | 显示全部楼层

剪切代码

$picConfig['width']     = 160;
                        $picConfig['height']    = 200;//需要剪切的图片的宽和高,需要根据网站实际情况进行修改...
                        $picConfig['x_axis']    = $_POST['left'];
                        $picConfig['y_axis']    = $_POST['top'];
                        $picConfig['image_library'] = 'gd2';
                        $picConfig['source_image']  = $tmpImgPath;//图片路径
                        $picConfig['maintain_ratio']= false;
                        $this->image_lib->initialize($picConfig);
                        if(! $this->image_lib->crop()){
                            echo $this->image_lib->display_errors();
                        }else {
                            $tpl = 'user/cropConfirm';
                            $data['tmpImgPath'] = substr($tmpImgPath, 1).'?t='.substr(microtime(),0,8);
                        }
 楼主| 发表于 2008-9-11 12:57:52 | 显示全部楼层

旋转代码

switch ($_POST['turn']){
                        case 1thumbConfig['rotation_angle']=270;break;
                        case 2thumbConfig['rotation_angle']=180;break;
                        case 3thumbConfig['rotation_angle']=90;break;
                        default:0;
                    }
                    $thumbConfig['x_axis']     = $_POST['left'];
                    $thumbConfig['y_axis']     = $_POST['top'];
                    $thumbConfig['image_library']  = 'gd2';
                    $thumbConfig['source_image']   = '.'.$_POST['imgPath'];
                    $tmpImgPath = dirname($thumbConfig['source_image']).'/temp_'.basename($thumbConfig['source_image']);
                    $sign = true;
                    if ( [email=!@copy($thumbConfig[]!@copy($thumbConfig['source_image'[/email]], $tmpImgPath)){
                        $sign=false;
                        echo '拷贝文件失败!';
                    }
                    if ($sign){
                        $thumbConfig['source_image'] = $tmpImgPath;
                        $this->load->library('image_lib',$thumbConfig);
                        if ($thumbConfig['rotation_angle'] >=90 && !$this->image_lib->rotate()) {
                            $sign = false;
                            echo $this->image_lib->display_errors();
                        }
                    }

提示服务器不支持旋转
 楼主| 发表于 2008-9-11 13:00:20 | 显示全部楼层

图片旋转时的错误提示

您的服务器图不支持图片旋转。Image rotation does not appear to be supported by your server
发表于 2008-9-11 14:05:54 | 显示全部楼层
看来还是服务器问题,我用图片处理类很正常。
服务器我就说不好怎么回事了,呵呵。
 楼主| 发表于 2008-9-11 14:31:32 | 显示全部楼层
这不等于白说吗?
 楼主| 发表于 2008-9-11 14:32:42 | 显示全部楼层
gd库的信息我已经给出了。
该安装的都已经安装了去不能运行。
为何不说是这个类的问题?

本版积分规则