Merge branch 'master' of gitee.com:hainatravel/information-system

hotfix/远程访问多媒体中心
cyc 7 years ago
commit 1541f27f65

@ -329,4 +329,33 @@ class Info_amp extends CI_Controller
));
}
}
public function handel_png_source() {
$png_base64 = $this->input->post('png_base64');
//$png_base64 = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$file = md5($png_base64).'.jpg';
$path = realpath('../cht-system/views/information/word_img').'/'.$file;
$png_base64 = str_replace('data:image/png;base64,', '', $png_base64);
$png_base64 = str_replace('data:image/jpg;base64,', '', $png_base64);
$png_base64 = base64_decode($png_base64);
$im = imagecreatefromstring($png_base64);
//保存图像
imagejpeg($im, $path);
//释放内存
imagedestroy($im);
$size = getimagesize($path);
if($png_base64 && $size) {
echo(json_encode(array(
'status' => 'success',
'path' => '/information-view/information/word_img/'.$file,
'width' => $size[0],
'height' => $size[1]
)));
} else {
echo(json_encode(array(
'status' => 'error'
)));
}
}
}

Loading…
Cancel
Save