php 读取目录下图像文件

 更新时间:2016年11月25日 16:58  点击:1847
本款是一款php 读取目录下图像文件哦,代码,他利用了opendir来打开目录然后获取文件后缀名,判断是否为指定文件。
 代码如下 复制代码

$directory = 'gallery';

$allowed_types=array('jpg','jpeg','gif','png');
$file_parts=array();
$ext='';
$title='';
$i=0;

$dir_handle = @opendir($directory) or die("there is an error with your image directory!");

while ($file = readdir($dir_handle))
{
 if($file=='.' || $file == '..') continue;
 
 $file_parts = explode('.',$file);
 $ext = strtolower(array_pop($file_parts));

 $title = implode('.',$file_parts);
 $title = htmlspecialchars($title);
 
 $nomargin='';
 
 if(in_array($ext,$allowed_types))
 {
  if(($i+1)%4==0) $nomargin='nomargin';
 
  echo '
  <div class="pic '.$nomargin.'" style="background:url('.$directory.'/'.$file.') no-repeat 50% 50%;">
  <a href="'.$directory.'/'.$file.'" title="'.$title.'" target="_blank">'.$title.'</a>
  </div>';
  
  $i++;
 }
}

closedir($dir_handle);

本款php生成验证码代码原理生成随机数-->创建图片-->随机数写进图片-->保存在session中 ,看一下流程验证码图片生成 通知浏览器将要输出PNG图片 准备好随机数发生器种子 srand((double)microtime()*1000000); 将四位整数验证码绘入图片
 代码如下 复制代码

/*=====================
产生随机字符串函数
=====================*/
function random($length) {
 $hash = '';
 $chars = 'abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz';
 $max = strlen($chars) - 1;
 mt_srand((double)microtime() * 1000000);
 for($i = 0; $i < $length; $i++) {
  $hash .= $chars[mt_rand(0, $max)];
 }
 return $hash;
}

//验证码图片生成

 session_start();
    //通知浏览器将要输出png图片
    header("content-type: image/png");
    //准备好随机数发生器种子 
    //srand((double)microtime()*1000000);
    //准备图片的相关参数  
    $im = imagecreate(62,22);
    $black = imagecolorallocate($im, 0,0,0);  //rgb黑色标识符
    $white = imagecolorallocate($im, 255,255,255); //rgb白色标识符
    $gray = imagecolorallocate($im, 179,183,185); //rgb灰色标识符
    //开始作图    
    imagefill($im,0,0,$gray);
    //while(($randval=rand()%100000)<10000);{
        //$_session["check_code"] = $randval;
        //将四位整数验证码绘入图片
  $randval=random(4);
  $_session["check_code"]=$randval;
        imagestring($im, 5, 10, 3, $randval, $white);
    //}
    //加入干扰象素   
    for($i=0;$i<150;$i++){
        $randcolor = imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
        imagesetpixel($im, rand()%70 , rand()%30 , $white);
    }
    //输出验证图片
    imagepng($im);
    //销毁图像标识符
    imagedestroy($im);

?>

这是一款图象缩略函数哦,把上传的新图片给$srcfile然后进行文件按$thumbwidth 缩小图宽最大尺寸 与$thumbheitht 缩小图高最大尺寸 生成小图。

图象缩略函数
参数说明:

 代码如下 复制代码
$srcfile 原图地址;
$dir  新图目录
$thumbwidth 缩小图宽最大尺寸
$thumbheitht 缩小图高最大尺寸
$ratio 默认等比例缩放 为1是缩小到固定尺寸。
*/
function makethumb($srcfile,$dir,$thumbwidth,$thumbheight,$ratio=0)
{
 //判断文件是否存在
if (!file_exists($srcfile))return false;
 //生成新的同名文件,但目录不同
$imgname=explode('/',$srcfile);
$arrcount=count($imgname);
$dstfile = $dir.$imgname[$arrcount-1];
//缩略图大小
$tow = $thumbwidth;
$toh = $thumbheight;
if($tow < 40) $tow = 40;
if($toh < 45) $toh = 45;   
 //获取图片信息
    $im ='';
    if($data = getimagesize($srcfile)) {
        if($data[2] == 1) {
            $make_max = 0;//gif不处理
            if(function_exists("imagecreatefromgif")) {
                $im = imagecreatefromgif($srcfile);
            }
        } elseif($data[2] == 2) {
            if(function_exists("imagecreatefromjpeg")) {
                $im = imagecreatefromjpeg($srcfile);
            }
        } elseif($data[2] == 3) {
            if(function_exists("imagecreatefrompng")) {
                $im = imagecreatefrompng($srcfile);
            }
        }
    }
    if(!$im) return '';
    $srcw = imagesx($im);
    $srch = imagesy($im);
    $towh = $tow/$toh;
    $srcwh = $srcw/$srch;
    if($towh <= $srcwh){
        $ftow = $tow;
        $ftoh = $ftow*($srch/$srcw);
    } else {
        $ftoh = $toh;
        $ftow = $ftoh*($srcw/$srch);
    }
    if($ratio){
        $ftow = $tow;
        $ftoh = $toh;
    }
    //缩小图片
    if($srcw > $tow || $srch > $toh || $ratio) {
        if(function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled") && @$ni = imagecreatetruecolor($ftow, $ftoh)) {
            imagecopyresampled($ni, $im, 0, 0, 0, 0, $ftow, $ftoh, $srcw, $srch);
        } elseif(function_exists("imagecreate") && function_exists("imagecopyresized") && @$ni = imagecreate($ftow, $ftoh)) {
            imagecopyresized($ni, $im, 0, 0, 0, 0, $ftow, $ftoh, $srcw, $srch);
        } else {
            return '';
        }
        if(function_exists('imagejpeg')) {
            imagejpeg($ni, $dstfile);
        } elseif(function_exists('imagepng')) {
            imagepng($ni, $dstfile);
        }
    }else {
        //小于尺寸直接复制
    copy($srcfile,$dstfile);
    }
    imagedestroy($im);
    if(!file_exists($dstfile)) {
        return '';
    } else {
        return $dstfile;
    }
}

?>

这是一款办外开的经典的php生成缩略图类函数,文件灵活实用,可以生成任何风格的图片,并且 可以把文本转换成图形。

copyright   : smart-info limited. all right reserved.
 author      : jacky cheung
 version     : 1.1
 create date : 24 september 2008
 last modify : 15 march 2009
*/

class gd
{
 var $font_face   = "";
 var $text   = "";
 var $size    = 12;
 var $color   = "#000000";
 var $angle   = 0;

 var $width   = 0;
 var $height   = 0;
 var $line_height = 0;
 
 var $type   = "png";
 var $chmod   = 0777;
 var $bg_color  = "#ffffff";
 var $quality  = 95;
 var $antialias  = true;
 
 var $x    = 0;
 var $y    = 0;
 

 /*___| convert text to image |___*/
  public function text2image ( $font_face="", $text="", $attributes=false, $width=0, $all=false )
  {
   $this->font_face  = $font_face;
   $this->text   = $text;
   $this->width  = $width;
   $this->size   = 12;
   $this->color  = "#000000";
   $this->angle  = 0;
   $this->line_height = 0;
   $this->setprop ( $attributes );
   
   if ( $this->width == 0 )
   {
    return $this->convert_text2image ( $this->text, $this->check_text_width( $this->text ) );
   } else {
    // word wrap
    if ( $all === false )
    {
     $text = split(" ", $this->text);
     $text = $this->word_wrap($this->text, $this->width, "<br>");
     $text = split("<br>", $text );
    } else if ( $all === true ) {
     $temp = array();
     for ( $i=0; $i<strlen($this->text); $i++ )
     {
      array_push ( $temp, mb_substr($this->text, $i, 1, "utf-8") );
     }
     $text = array();
     $count_width = 0;
     $i = 0;
     foreach ( $temp as $k => $t )
     {
      $prop = $this->check_text_width($t);
      if ( $count_width + floatval($prop["width"]) < $this->width )
      {
       $text[$i] = $text[$i] . $t;
       $count_width += floatval($prop["width"]);
      } else {
       $count_width = 0;
       $i++;
       $text[$i] = "";
      }
     }
    }
    
    $img = array();
    foreach ( $text as $k => $t )
    {
     $img[$k] = $this->convert_text2image ( $t,  $this->check_text_width( $t ) );
    }
    
    $w = 0;
    $h = 0;
    foreach ( $img as $k => $v )
    {
     $w = (imagesx($img[$k]) > $w) ? imagesx($img[$k]) : $w;

     if ($this->line_height == 0 ) $h += imagesy($img[$k]);
     else $h += ($k < count($img)-1) ? $this->line_height : imagesy($img[$k]);
    }
    
    $base_img = $this->createtransparent($w, $h);
    $locy = 0;
    foreach ( $img as $k => $v )
    {
     if ($k > 0)
     {
      $locy = ($this->line_height == 0) ? $locy + imagesy($img[$k]) : $locy + $this->line_height;
     }
     $base_img = $this->attachgdimage ( $img[$k], $base_img, array ("x"=>0, "y"=>$locy) );
    }
    return $base_img;
   }
  }
  private function word_wrap( $str, $width, $break )
  {
   $formatted = '';
   $position = -1;
   $prev_position = 0;
   $last_line = -1;
   
   /// looping the string stop at each space
   while( $position = mb_stripos( $str, " ", ++$position, 'utf-8' ) ) {
    if( $position > $last_line + $width + 1 ) {
     $formatted.= mb_substr( $str, $last_line + 1, $prev_position - $last_line - 1, 'utf-8' ).$break;
     $last_line = $prev_position;
    }
    $prev_position = $position;
   }
   
   /// adding last line without the break
   $formatted.= mb_substr( $str, $last_line + 1, mb_strlen( $str ), 'utf-8' );
   return $formatted;
  }


  public function convert_text2image ( $text, $prop )
  {
   $im   = imagecreatetruecolor ( $prop["width"], $prop["height"] );
   $rgb   = $this->getrgb ( $this->color );
   $color   = imagecolorallocate ( $im, $rgb["red"], $rgb["green"], $rgb["blue"] );
   $img   = $this->createtransparent ( $prop["width"], $prop["height"] );
   imagettftext ( $img, $this->size, $this->angle, 0, $prop["height"] - abs ( $prop["top"] ), $color, $this->font_face, $text );
   return $img;
  }
  public function check_text_width ( $text )
  {
   $prop = array();
   $bbox    = imagettfbbox ( $this->size, $this->angle, $this->font_face, $text );
   $prop["left"]  = $bbox[0];
   $prop["right"]  = $bbox[2];
   $prop["top"] = $bbox[1];
   $prop["bottom"] = $bbox[7];
   $padding  = 2;
  
   $prop["width"]  = abs($prop["left"]) + abs($prop["right"])  + $padding;
   $prop["height"] = abs($prop["top"])  + abs($prop["bottom"]) + $padding;
   
   return $prop;
  }


 /*___| save to image file |___*/
  public function save($gdimage, $filename, $attributes=false)
  {
   $this->type   = "png";
   $this->chmod   = 0777;
   $this->bg_color  = "#ffffff";
   $this->quality  = 95;
   $this->antialias = true;
   
   $this->setprop ( $attributes );
   
   // process
   switch ( strtolower ( $this->type ) )
   {
    case "jpeg":
    case "jpg":
     $gdimage = $this->createbackground($gdimage, imagesx($gdimage), imagesy($gdimage));
     imagejpeg ( $gdimage, $filename, $this->quality );
     break;
    case "gif":
     $gdimage = $this->createbackground($gdimage, imagesx($gdimage), imagesy($gdimage));
     imagegif ( $gdimage, $filename );
     break;   
    case "png":
    default :
     imagepng ( $gdimage, $filename );
     break;
   }
   chmod ( $filename, $this->chmod );
  }


 /*___| create gd background image |___*/
  public function createbackground($gdimage, $width, $height)
  {
   $img = imagecreatetruecolor ( $width, $height );
   $rgb = $this->getrgb ( $this->bg_color );
   $color = imagecolorallocate ( $img, $rgb["red"], $rgb["green"], $rgb["blue"] );
   imagefill ( $img, 0, 0, $color );
   imagecopyresampled ( $img, $gdimage, 0, 0, 0, 0, $width, $height, $width, $height );
   return $img;
  }


 /*___| create gd transparent image |___*/
  public function createtransparent($width, $height)
  {
   $img = imagecreatetruecolor($width, $height);
   imagealphablending($img, false);
   imagesavealpha($img, true);
   $transparent = imagecolorallocatealpha($img, 0, 0, 0, 127);
   imagefilledrectangle($img, 0, 0, $width, $height, $transparent);
   imagecopyresampled($img, $img, 0, 0, 0, 0, $width, $height, $width, $height);
   return $img;
  }

 
 /*___| load image |___*/
  public function createimagefrom($filename, $alpha=true)
  {
   if ( function_exists ( "exif_imagetype" ) )
   {
    if ( exif_imagetype ( $filename )   == imagetype_jpeg ) { return $this->createfromjpeg ( $filename ); }
    else if ( exif_imagetype ( $filename )  == imagetype_gif  ) { return $this->createfromgif  ( $filename ); }
    else if ( exif_imagetype ( $filename )  == imagetype_png  ) { return $this->createfrompng  ( $filename, $alpha ); }
   }
   else
   {
    if ( strstr ( strtoupper ( $filename )  , ".jpg" )  || strstr ( strtoupper ( $filename ), ".jpeg" )) { return $this->createfromjpeg ( $filename ); }
    else if ( strstr ( strtoupper ( $filename ) , ".gif" )) { return $this->createfromgif ( $filename ); }
    else if ( strstr ( strtoupper ( $filename ) , ".png" )) { return $this->createfrompng ( $filename, $alpha ); }
   }
   return false;
  }
  private function createfromjpeg ( $filename ) { return imagecreatefromjpeg ( $filename ); }
  private function createfromgif  ( $filename ) { return imagecreatefromgif  ( $filename ); }
  private function createfrompng  ( $filename, $alpha=true )
  {
   if ( $alpha )
   {
    list ( $width, $height ) = getimagesize ( $filename );
    $png_img = imagecreatefrompng ( $filename );
    $img = imagecreatetruecolor ( $width, $height );
    imagealphablending ( $img, false );
    imagesavealpha ( $img, true );
    imagecopyresampled ( $img, $png_img, 0, 0, 0, 0, $width, $height, $width, $height );
   } else {
    $img = imagecreatefrompng ( $filename );
   } 
   return $img;
  }
 
 
 /*___| attach background image |___*/
  public function attachbackgroundimage ( $gdimage, $filename, $attributes=false )
  {
   $this->x = 0;
   $this->y = 0;
   $this->setprop ( $attributes );
  
   $img = $this->createimagefrom ( $filename );
   imagecopyresampled ( $img, $gdimage, $this->x, $this->y, 0, 0, imagesx($gdimage), imagesy($gdimage), imagesx($gdimage), imagesy($gdimage) );
   return $img;
  }


 /*___| attach image |___*/
  public function attachimage ( $source, $target, $filename, $image_attributes=false, $attributes=false )
  {
   $source_img = $this->createimagefrom ( $source );
   $target_img = $this->attachbackgroundimage ( $source_img, $target, $attributes );
   $this->save ( $target_img, $filename, $image_attributes );
  }
  
 
 /*___| attach gd image resource |___*/
  public function attachgdimage ( $gd_source, $gd_target, $attributes=false )
  {
   $this->x  = 0;
   $this->y  = 0;
   $this->width = 0;
   $this->height = 0;
   $this->setprop ( $attributes );
   
   imagealphablending($gd_target, true );
   imagealphablending($gd_source, true );
   imagecopy ( $gd_target, $gd_source, $this->x, $this->y, 0, 0, imagesx($gd_source), imagesy($gd_source) );
   return $gd_target;
  }
 
 
 /*___| get rgb color |___*/
  public function getrgb($hex)
  {
   $rgb["red"]   = hexdec ( substr ( $hex, 1, 2 ) ) ;
   $rgb["green"] = hexdec ( substr ( $hex, 3, 2 ) ) ;
   $rgb["blue"]  = hexdec ( substr ( $hex, 5, 2 ) ) ;
   return $rgb;
  }
 
 
 /*___| set properties |___*/ 
  private function setprop ( $attributes=false )
  {
   if ( $attributes ) { foreach  ( $attributes as $key => $value ) { $k = strtoupper ( $key ); $this->$k = $value; } }
  }
}

//调用 方法

 代码如下 复制代码
$imgresize = new imagetransform();
$imgresize->sourcefile = $source.$file;
$imgresize->targetfile = $destination.$file;
$imgresize->chmodvalue = 0777; 
$imgresize->resizetowidth = $tw;
$imgresize->resizetoheight = $th;
$imgresize->jpegoutputquality = 100;
$imgresize->resizeifsmaller = false;
$imgresize->resize();

?>

本文章收藏了四款关于利用php 等比例缩小图片代码函数,我们可定义图片宽度或高度对图片缩小或放大的图片宽度哦,好了看看四款实例那一款适合于你吧。
 代码如下 复制代码

function imageresize2($width, $height, $targetw, $targeth)
{
  $percentage = 1;
  if (($width > $targetw) || ($height > $targeth))
  {
 $width_diff = $width - $targetw;
 $height_diff = $height - $targeth;
 
 if ($width_diff >= $height_diff)
 {
  $percentage = ($targetw / $width);
 }
 else
 {
  $percentage = ($targeth / $height);
 }
  }
 //gets the new value and applies the percentage, then rounds the value
 $width = round($width * $percentage);
 $height = round($height * $percentage);
 $resize[0] = $width;
 $resize[1] = $height;
 return $resize;
}

//方法二

if (!$max_width)  
  $max_width = 240;  
if (!$max_height)  
  $max_height = 200;  
 
$size = getimagesize($image);  
$width = $size[0];  
$height = $size[1];  
 
$x_ratio = $max_width / $width;  
$y_ratio = $max_height / $height;  
 
if ( ($width <= $max_width) && ($height <= $max_height) ) {  
  $tn_width = $width;  
  $tn_height = $height;  
}  
else if (($x_ratio * $height) < $max_height) {  
  $tn_height = ceil($x_ratio * $height);  
  $tn_width = $max_width;  
}  
else {  
  $tn_width = ceil($y_ratio * $width);  
  $tn_height = $max_height;  
}  
 
$src = imagecreatefrompng($image);  
$dst = imagecreate($tn_width,$tn_height);  
imagecopyresized($dst, $src, 0, 0, 0, 0,  
    $tn_width,$tn_height,$width,$height);  
header("content-type: image/png");  
imagepng($dst, null, -1);  
imagedestroy($src);  
imagedestroy($dst);  

//方法三

/*
函数原型如下:
参数说明:
$oldwidth:原图片宽度
$oldheight:原图片高度
$imgwidth:缩小或放大的图片宽度
$imgheight:缩小或放大的图片高度
返回:wwww.111cn.net
数组:arraysize ,其中索引为:width 和height 即:arraysize['width']、arraysize['height']
*/
function getimgsize($oldwidth,$oldheight,$imgwidth,$imgheight)
{
//$oldwidth设置的宽度,$oldheight设置的高度,$imgwidth图片的宽度,$imgheight图片的高度;

//单元格装得能装得进图片,则按图片的真实大小显示;
if($imgwidth<=$oldwidth&&$imgheight<=$oldheight)
{
$arraysize=array('width'=>$imgwidth,'height'=>$imgheight);
return $arraysize;
}
else
{
$suoxiaowidth=$imgwidth-$oldwidth;
$suoxiaoheight=$imgheight-$oldheight;
$suoxiaoheightper=$suoxiaoheight/$imgheight;
$suoxiaowidthper=$suoxiaowidth/$imgwidth;
if($suoxiaoheightper>=$suoxiaowidthper)
{
//单元格高度为准;
$aftersuoxiaowidth=$imgwidth*(1-$suoxiaoheightper);
$arraysize=array('width'=>$aftersuoxiaowidth,'height'=>$oldheight);
return $arraysize;
}
else
{
//单元格宽度为准;
$aftersuoxiaoheight=$imgheight*(1-$suoxiaowidthper);
$arraysize=array('width'=>$oldwidth,'height'=>$aftersuoxiaoheight);
return $arraysize;
}
}
}

?>

[!--infotagslink--]

相关文章

  • php读取zip文件(删除文件,提取文件,增加文件)实例

    下面小编来给大家演示几个php操作zip文件的实例,我们可以读取zip包中指定文件与删除zip包中指定文件,下面来给大这介绍一下。 从zip压缩文件中提取文件 代...2016-11-25
  • Jupyter Notebook读取csv文件出现的问题及解决

    这篇文章主要介绍了JupyterNotebook读取csv文件出现的问题及解决,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2023-01-06
  • C#从数据库读取图片并保存的两种方法

    这篇文章主要介绍了C#从数据库读取图片并保存的方法,帮助大家更好的理解和使用c#,感兴趣的朋友可以了解下...2021-01-16
  • Photoshop打开PSD文件空白怎么解决

    有时我们接受或下载到的PSD文件打开是空白的,那么我们要如何来解决这个 问题了,下面一聚教程小伙伴就为各位介绍Photoshop打开PSD文件空白解决办法。 1、如我们打开...2016-09-14
  • C#操作本地文件及保存文件到数据库的基本方法总结

    C#使用System.IO中的文件操作方法在Windows系统中处理本地文件相当顺手,这里我们还总结了在Oracle中保存文件的方法,嗯,接下来就来看看整理的C#操作本地文件及保存文件到数据库的基本方法总结...2020-06-25
  • 解决python 使用openpyxl读写大文件的坑

    这篇文章主要介绍了解决python 使用openpyxl读写大文件的坑,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-13
  • C#实现HTTP下载文件的方法

    这篇文章主要介绍了C#实现HTTP下载文件的方法,包括了HTTP通信的创建、本地文件的写入等,非常具有实用价值,需要的朋友可以参考下...2020-06-25
  • SpringBoot实现excel文件生成和下载

    这篇文章主要为大家详细介绍了SpringBoot实现excel文件生成和下载,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-02-09
  • php把读取xml 文档并转换成json数据代码

    在php中解析xml文档用专门的函数domdocument来处理,把json在php中也有相关的处理函数,我们要把数据xml 数据存到一个数据再用json_encode直接换成json数据就OK了。...2016-11-25
  • php无刷新利用iframe实现页面无刷新上传文件(1/2)

    利用form表单的target属性和iframe 一、上传文件的一个php教程方法。 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失...2016-11-25
  • php批量替换内容或指定目录下所有文件内容

    要替换字符串中的内容我们只要利用php相关函数,如strstr,str_replace,正则表达式了,那么我们要替换目录所有文件的内容就需要先遍历目录再打开文件再利用上面讲的函数替...2016-11-25
  • PHP文件上传一些小收获

    又码了一个周末的代码,这次在做一些关于文件上传的东西。(PHP UPLOAD)小有收获项目是一个BT种子列表,用户有权限上传自己的种子,然后配合BT TRACK服务器把种子的信息写出来...2016-11-25
  • AI源文件转photoshop图像变模糊问题解决教程

    今天小编在这里就来给photoshop的这一款软件的使用者们来说下AI源文件转photoshop图像变模糊问题的解决教程,各位想知道具体解决方法的使用者们,那么下面就快来跟着小编...2016-09-14
  • C++万能库头文件在vs中的安装步骤(图文)

    这篇文章主要介绍了C++万能库头文件在vs中的安装步骤(图文),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-23
  • Zend studio文件注释模板设置方法

    步骤:Window -> PHP -> Editor -> Templates,这里可以设置(增、删、改、导入等)管理你的模板。新建文件注释、函数注释、代码块等模板的实例新建模板,分别输入Name、Description、Patterna)文件注释Name: 3cfileDescriptio...2013-10-04
  • php文件上传你必须知道的几点

    本篇文章主要说明的是与php文件上传的相关配置的知识点。PHP文件上传功能配置主要涉及php.ini配置文件中的upload_tmp_dir、upload_max_filesize、post_max_size等选项,下面一一说明。打开php.ini配置文件找到File Upl...2015-10-21
  • ant design中upload组件上传大文件,显示进度条进度的实例

    这篇文章主要介绍了ant design中upload组件上传大文件,显示进度条进度的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-10-29
  • C#使用StreamWriter写入文件的方法

    这篇文章主要介绍了C#使用StreamWriter写入文件的方法,涉及C#中StreamWriter类操作文件的相关技巧,需要的朋友可以参考下...2020-06-25
  • php实现文件下载实例分享

    举一个案例:复制代码 代码如下:<?phpclass Downfile { function downserver($file_name){$file_path = "./img/".$file_name;//转码,文件名转为gb2312解决中文乱码$file_name = iconv("utf-8","gb2312",$file_name...2014-06-07
  • C#路径,文件,目录及IO常见操作汇总

    这篇文章主要介绍了C#路径,文件,目录及IO常见操作,较为详细的分析并汇总了C#关于路径,文件,目录及IO常见操作,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25