欢迎各位兄弟 发布技术文章
这里的技术是共享的
if(($request->hasFile('system_info_favicon'))){
$file = $request->file('system_info_favicon');
if($file->isValid()){
if ($im = @imagecreatefrompng($_FILES['system_info_favicon']['tmp_name']) or $im = @imagecreatefromgif($_FILES['system_info_favicon']['tmp_name']) or $im = @imagecreatefromjpeg($_FILES['system_info_favicon']['tmp_name'])) {
$imginfo = @getimagesize($_FILES['system_info_favicon']['tmp_name']);
if (!is_array($imginfo)) {
//$error['text'] = "图形格式错误!";
}else {
$resize_im = @imagecreatetruecolor(16, 16);
$size = 16;
imagecopyresampled($resize_im, $im, 0, 0, 0, 0, $size, $size, $imginfo[0], $imginfo[1]);
$icon = new Iconv();
$gd_image_array = array($resize_im);
$icon_data = $icon->GDtoICOstr($gd_image_array);
$filename = "favicon.ico";
//@unlink ($filename);
if (file_put_contents($filename, $icon_data)) {
// $output = "生成成功!请点右键->另存为 保存到本地<br><a href="/" mce_href="/""".$filename."/" target=/"_blank/">点击下载</a>";
// echo $filename;
//数据展示
}
}
}
}
}