用户名:
密 码: 记住
您当前的位置:首页 > 网络编程 > php教程

php imagecreatefromgif创建gif图片

时间:2015-01-23  来源:西部数据  作者:西部数据

php imagecreatefromgif创建gif图片

imagecreatefromgif($filename)

imagecreatefromgif()返回一个图像标识符代表从给定的文件名获得的图像

$filename是gif图片名称,来看个实例:

  1. <?php 
  2. function LoadGif($imgname
  3.     /* Attempt to open */ 
  4.     $im = @imagecreatefromgif($imgname); 
  5.  
  6.     /* See if it failed */ 
  7.     if(!$im
  8.     {//开源代码phpfensi.com 
  9.         /* Create a blank image */ 
  10.         $im = imagecreatetruecolor (150, 30); 
  11.         $bgc = imagecolorallocate ($im, 255, 255, 255); 
  12.         $tc = imagecolorallocate ($im, 0, 0, 0); 
  13.  
  14.         imagefilledrectangle ($im, 0, 0, 150, 30, $bgc); 
  15.  
  16.         /* Output an error message */ 
  17.         imagestring ($im, 1, 5, 5, 'Error loading ' . $imgname$tc); 
  18.     } 
  19.  
  20.     return $im
  21.  
  22. header('Content-Type: image/gif'); 
  23.  
  24. $img = LoadGif('bogus.image'); 
  25.  
  26. imagegif($img); 
  27. imagedestroy($img); 
  28. ?> 
来顶一下
返回首页
返回首页
推荐资讯
WiFi太不安全:7岁女孩11分钟内入侵公共网络 WiFi太不安全:7岁女孩11分钟内入侵近期刚刚发布研究说WiFi网络能获得人们手机里多少私人信息,
不服跑个分?人工智能也出现“刷分”乱象 不服跑个分?人工智能也出现“刷分2014年,人工智能领域突然爆发,成为了科研和科技创业的热门
相关文章
栏目更新
栏目热门