然而我的GD安装并且正常工作,因为我在本地测试但是当我上传到客户端服务器时它显示错误"图像"无法显示,因为它包含错误。
我访问图像localhost / validate_image / show_image
我的 validate_image 控制器代码
function show_image() {
$width = "200px";
$height = "200px";
$imageName = "HFPFinalLogoJpeg.jpg";
$dir=realpath(MERCHANT_IMAGE);
//Below constants are already included in application/config/constants.php file its here to just show you
$this->load->library('image_lib');
$this->image_lib->clear();
$config['image_library'] = 'gd2';
$config['source_image'] = $dir."/".$imageName;
$config['maintain_ratio'] = FALSE;
$config['dynamic_output'] = TRUE;
$config['width'] = $width;
$config['height'] = $height;
//print_r($config); die;
$this->image_lib->initialize($config);
echo $this->image_lib->resize();
}
我的 show_image 查看代码
<?php
$image_properties = array(
'src' => base_url()."validate_image/show_image/220/280",
'alt' => "title Image",
'title' => 'title Image',
'width'=>135,
'height'=>135,
'border' => "0",
);
echo img($image_properties);
?>
我尝试了谷歌搜索,但没有解决方案如下。我的PHP版本5.4.35
请帮我解决这个问题。