linux下图片不能旋转以及图片变成黑白色
我在windows下的使用完全正常。可在LINUX下遇到里以下问题:使用image_lib在LINUX下不能旋转。 并且经过处理后(放大或缩小等剪切的动作后),图片自动变成了黑白色,
找了好久的原因仍没有找出来, 我用的是gd2.0.35。即最新版本。
gd库支持信息如下:
gdGD 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相关包。
请问下如何解决?在线等待... 你的 CI 代码是什么样的?
剪切代码
$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);
}
旋转代码
switch ($_POST['turn']){case 1:$thumbConfig['rotation_angle']=270;break;
case 2:$thumbConfig['rotation_angle']=180;break;
case 3:$thumbConfig['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 ( !@copy($thumbConfig['source_image'], $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();
}
}
提示服务器不支持旋转
图片旋转时的错误提示
您的服务器图不支持图片旋转。Image rotation does not appear to be supported by your server 看来还是服务器问题,我用图片处理类很正常。服务器我就说不好怎么回事了,呵呵。 这不等于白说吗? gd库的信息我已经给出了。
该安装的都已经安装了去不能运行。
为何不说是这个类的问题?
页:
[1]