php thinkphp imagepng无法显示图片
2015-01-16 13:27
976 查看
php代码浏览器可正常显示图片,thinkPhp控制器不可行在header前加上
即可
thinkphp 控制器代码
ob_clean ();
即可
thinkphp 控制器代码
/** * 显示图标 */ public function icon() { //清除输出,去掉前面的html ob_clean (); header ( "Content-type: image/png" ); // 文件名 $type = $_GET ["type"]; if (empty ( $_GET ["color"] )) { $fileName = $type . '.png'; } else { $color = $_GET ["color"]; $fileName = $type . '_' . $color . '.png'; } // 旋转角度 $angle = $_GET ["angle"]; if ($angle > 180) { $angle = 360 - $angle; } else { $angle = - $angle; } // 文件绝对路径 $fileName2 = IconPath . $fileName; // 实例图片 $im = imagecreatefrompng ( $fileName2 ); $alpha = imagecolorallocatealpha ( $im, 0, 0, 0, 127 ); $re = imagerotate ( $im, $angle, $alpha ); // 保留透明度 imagesavealpha ( $re, true ); // 输出到浏览器 imagepng ( $re ); imagedestroy ( $im ); imagedestroy ( $re ); }
相关文章推荐
- PHP5.4+IIS7+WINSRV2008 imagepng无法显示图片的问题
- PHP5.4+IIS7+WINSRV2008 imagepng无法显示图片的问题
- php上传图片到数据库与网页无法显示的问题
- Thinkphp 在linux下无法正常显示验证码图片,该怎么解决
- 语言 php 在64位linux下 imagepng()无法生成图片
- php 查询数据库所要输出的图片无法在浏览器上显示
- PHP动态生成的图片无法显示问题
- PHP 验证码图片无法正常显示
- php for linux 图片无法显示问题
- mac php 图片验证码无法显示问题,gd库没有freetype的问题
- mac php 图片验证码无法显示问题
- PHP图片验证码无法显示问题
- php图片本身有错无法显示的解决办法
- linux下php无法显示图片
- linux下 php img 图片无法显示
- 水晶报表发布后工具栏图片无法显示的解决方案
- 关于CSDN登录时,图片检验码无法显示的问题处理
- 这个博客不好用,图片都无法显示
- 用PHP程序实现随机广告图片显示
- 用户自定义控件的背景图片无法正常显示