但是,当我在本地测试时,我的 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
请帮我解决这个问题。