一聚教程网:一个值得你收藏的教程网站

热门教程

php 图片下载程序

时间:2022-07-02 10:15:14 编辑:袖梨 来源:一聚教程网

function displayimg($image)
 {
  $image = './upload/'.imgdecode($image);
  //echo $image;exit;
  if (file_exists($image))
  {
   $info = getimagesize($image);
   header("Content-type:$info[mime]");
   switch ($info[2])
   {
    case 1:  $cimage = imagecreatefromgif($image);
       imagegif($cimage);
       imagedestroy($cimage);
       break;
    case 2:  $cimage = imagecreatefromjpeg($image);
       imagejpeg($cimage);
       imagedestroy($cimage);
       break;
    case 3:  $cimage = imagecreatefrompng($image);
       imagepng($cimage);
       imagedestroy($cimage);
       break;
    case 6:  $cimage = imagecreatefromwbmp($image);
       imagewbmp($cimage);
       imagedestroy($cimage);
       break;
   }
   echo $simage;
  }
  else
  {
   header("HTTP/1.0 404 Not Found");
  }
 }

热门栏目