【发布时间】:2018-03-23 17:30:23
【问题描述】:
我正在 codeigniter 中创建一个项目,用户可以在其中上传他的个人资料图片。我正在使用图像库上传它。当我在 IOS 设备中使用相机上传图像时,上传的图像带有一些灰色区域。库中的代码是
function createImage($iMageName,$folderName){
$width = 500; $height = true;
$data=base64_decode($iMageName);
$f = finfo_open();
$mime_type = finfo_buffer($f, $data, FILEINFO_MIME_TYPE);
$image = imagecreatefromstring($data);
$height = $height === true ? (ImageSY($image) * $width / ImageSX($image)) : $height;
$output = ImageCreateTrueColor($width, $height);
$imgThumb=uniqid().strtotime(date("Y-m-d H:i:s")).'.jpg';
$imageName=$folderName.$imgThumb;
$fullpath=FCPATH.$imageName;
ImageCopyResampled($output, $image, 0, 0, 0, 0, $width, $height, ImageSX($image), ImageSY($image));
imagejpeg($output, $fullpath, 90);
return $imageName;
}
【问题讨论】:
标签: php ios image-uploading