当前位置:首页
开发技术指南» 文章正文
    引言:

 ·怎样把硬盘分区    »显示摘要«
    摘要: 现在的机器上d盘太大,想再分一个扩展分区,但是我装的是windows 2000 server,很多分区工具都用不了,请各位帮忙! ......
 ·再问两个关于网页设计的问题    »显示摘要«
    摘要: 1、在使用dreamweaver制作表格时,我发现对边框要么都显示,要么都不显示,请问:如何做到只显示表格(或其中单元格)的某一条(或几条)边框? 2、请推荐几个关于css的好书(电子版更好)!苏沈小雨的那本css2中文手册---按传统的观点讲,只能算是css的“函数库详解”而非css的“语言学习指导”---不知诸位是否也有同感? ......


这样怎么不能显示微缩图

<html>  
  <head>  
  <title>生成微缩图</title>  
  </head>  
  <body>  
  <?php  
  function   makethumb($srcFile,$dstFile,$dstW,$dstH)  
    {  
          $data=GetImageSize($srcFile);  
  switch($data[2])  
          {  
        case   1:  
            $imgsrc=@ImageCreateFromGIF($srcFile);  
    break;  
        case   2:  
            $imgsrc=@ImageCreateFromJPEG($srcFile);  
    break;  
        case   3:  
            $imgsrc=@ImageCreateFromPNG($srcFile);  
    break;  
    }  
  $srcW=ImageSX($imgsrc);  
  $srcH=ImageSY($imgsrc);  
  $ni=ImageCreate($dstW,$dstH);  
  ImageCopyResized($ni,$imgsrc,0,0,0,0,$dstW,$dstH,$srcW,$srcH);  
  return   ImagePNG($ni);  
    }  
  ?>  
  <?php  
  $img=makethumb("1.jpg","",20,20);  
  Header(   "Content-type:image/PNG");  
  echo   $img->Image;  
  ?>  
  </body>  
  </html>

NO.1   作者: hahu

<?php  
  function   makethumb($srcFile,$dstFile,$dstW,$dstH)  
    {  
          $data=GetImageSize($srcFile);  
  switch($data[2])  
          {  
        case   1:  
            $imgsrc=@ImageCreateFromGIF($srcFile);  
    break;  
        case   2:  
            $imgsrc=@ImageCreateFromJPEG($srcFile);  
    break;  
        case   3:  
            $imgsrc=@ImageCreateFromPNG($srcFile);  
    break;  
    }  
  $srcW=ImageSX($imgsrc);  
  $srcH=ImageSY($imgsrc);  
  $ni=ImageCreate($dstW,$dstH);  
  ImageCopyResized($ni,$imgsrc,0,0,0,0,$dstW,$dstH,$srcW,$srcH);  
  return   ImagePNG($ni);  
    }  
  Header(   "Content-type:image/PNG");  
  $img=makethumb("0008.jpg","",20,20);  
  echo   $img->Image;  
  ?>  
   
  Header(   "Content-type:image/PNG");  
  放在makethumb上面看看  
  <?php   前面不要有换行  
  <?php   ?>  
  外面不要有空白行  
  呵呵,我也是php外行

NO.2   作者: xuzuning

<?php  
  function   makethumb($srcFile,$dstFile,$dstW,$dstH)  
    {  
          $data=GetImageSize($srcFile);  
  switch($data[2])  
          {  
        case   1:  
            $imgsrc=@ImageCreateFromGIF($srcFile);  
    break;  
        case   2:  
            $imgsrc=@ImageCreateFromJPEG($srcFile);  
    break;  
        case   3:  
            $imgsrc=@ImageCreateFromPNG($srcFile);  
    break;  
    }  
  $srcW=ImageSX($imgsrc);  
  $srcH=ImageSY($imgsrc);  
  $ni=ImageCreate($dstW,$dstH);  
  ImageCopyResized($ni,$imgsrc,0,0,0,0,$dstW,$dstH,$srcW,$srcH);  
  ImagePNG($ni);  
    }  
   
  Header(   "Content-type:image/PNG");  
  makethumb("1.jpg","",20,20);  
  ?>  
  只需要这么多

NO.3   作者: wctt

<?    
   
  $FILENAME="1";    
   
  //   生成图片的宽度    
  $RESIZEWIDTH=20;    
   
  //   生成图片的高度    
  $RESIZEHEIGHT=20;    
   
   
  function   ResizeImage($im,$maxwidth,$maxheight,$name){    
          $width   =   imagesx($im);    
          $height   =   imagesy($im);    
          if(($maxwidth   &&   $width   >   $maxwidth)   ||   ($maxheight   &&   $height   >   $maxheight)){    
                  if($maxwidth   &&   $width   >   $maxwidth){    
                          $widthratio   =   $maxwidth/$width;    
                          $RESIZEWIDTH=true;    
                  }    
                  if($maxheight   &&   $height   >   $maxheight){    
                          $heightratio   =   $maxheight/$height;    
                          $RESIZEHEIGHT=true;    
                  }    
                  if($RESIZEWIDTH   &&   $RESIZEHEIGHT){    
                          if($widthratio   <   $heightratio){    
                                  $ratio   =   $widthratio;    
                          }else{    
                                  $ratio   =   $heightratio;    
                          }    
                  }elseif($RESIZEWIDTH){    
                          $ratio   =   $widthratio;    
                  }elseif($RESIZEHEIGHT){    
                          $ratio   =   $heightratio;    
                  }    
                  $newwidth   =   $width   *   $ratio;    
                  $newheight   =   $height   *   $ratio;    
                  if(function_exists("imagecopyresampled")){    
                              $newim   =   imagecreatetruecolor($newwidth,   $newheight);    
                              imagecopyresampled($newim,   $im,   0,   0,   0,   0,   $newwidth,   $newheight,   $width,   $height);    
                  }else{    
                          $newim   =   imagecreate($newwidth,   $newheight);    
                              imagecopyresized($newim,   $im,   0,   0,   0,   0,   $newwidth,   $newheight,   $width,   $height);    
                  }    
                  ImageJpeg   ($newim,$name   .   ".jpg");    
                  ImageDestroy   ($newim);    
          }else{    
                  ImageJpeg   ($im,$name   .   ".jpg");    
          }    
  }    
   
   
   
  if($_FILES[zhaopian_up][size]){    
          if($_FILES[zhaopian_up][type]   ==   "image/pjpeg"){    
                  $im   =   imagecreatefromjpeg($_FILES[zhaopian_up][tmp_name]);    
          }elseif($_FILES[zhaopian_up][type]   ==   "image/x-png"){    
                  $im   =   imagecreatefrompng($_FILES[zhaopian_up][tmp_name]);    
          }elseif($_FILES[zhaopian_up][type]   ==   "image/gif"){    
                  $im   =   imagecreatefromgif($_FILES[zhaopian_up][tmp_name]);    
          }    
          if($im){    
                  if(file_exists("$FILENAME.jpg")){    
                          unlink("$FILENAME.jpg");    
                  }    
                  ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME);    
                  ImageDestroy   ($im);    
          }    
  }    
   
  ?>    
  <html><body><script   language="JavaScript">  
  <!--  
  function   CheckForm(theForm)  
  {  
  var   fileext=theForm.zhaopian_up.value.substring(theForm.zhaopian_up.value.length-4,theForm.zhaopian_up.value.length)  
  fileext=fileext.toLowerCase()  
  if   (!(fileext==.jpg   ||   fileext==.png))  
  {alert("对不起,不正确的照片文件,必须为*.jpg或*.png文件   !");  
  theForm.zhaopian_up.focus();  
  return   false;  
  }  
  return   true;  
  }  
  //   -->  
  </SCRIPT>  
  <img   src="<?   echo($FILENAME.".jpg?reload=".rand(0,999999));   ?>"><br><br>    
   
  <FORM   ENCTYPE="multipart/form-data"   ACTION="yht4.php"   METHOD="POST"   onsubmit="return   CheckForm(this)">  
  <p   class="big">   上传照片:</p>  
  <input   type="file"   name="zhaopian_up"   size="20">   <INPUT   TYPE="submit"   value="上传">  
   
  </form>    
   
   
  </body>    
  </html>


    摘要: 我现在第一次用.net写c程序,是一个c/s结构的,服务器端用的web service. 现在在调试程序的时候,发现打开客户端的时候,这个程序占用了20多m的内存,最多的时候用了30m的程序!程序没有使用任何有关内存管理和强制释放资源的代码! 我想知道,程序在实际运行时要使用的内存是不是和调试的时候一样?对于程序有没有必要使用内存优化代码来减少对内存的使用呢? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE