haidong 发表于 2010-2-24 13:43:37

将图片转为html格式

<OL><LI><CODE><FONT face=新宋体>&lt;?</FONT></CODE><LI><CODE><FONT face=新宋体>//将图片转为html格式,需要GD库支持。转换成html文件后文件非常大。所以,程序本身并不实用!</FONT></CODE><LI><CODE><FONT face=新宋体>function htmlimg($im,$zf="█",$size="8"){</FONT></CODE><LI><CODE><FONT face=新宋体>    $im=<A href="http://www.php.net/manual/zh/function.imagecreatefromjpeg"><U><FONT color=#0000ff>imagecreatefromjpeg</FONT></U></A>($im);</FONT></CODE><LI><CODE><FONT face=新宋体>    $width=<A href="http://www.php.net/manual/zh/function.imagesx"><U><FONT color=#0000ff>imagesx</FONT></U></A>($im);</FONT></CODE><LI><CODE><FONT face=新宋体>    $height=<A href="http://www.php.net/manual/zh/function.imagesy"><U><FONT color=#0000ff>imagesy</FONT></U></A>($im);</FONT></CODE><LI><CODE><FONT face=新宋体>    echo "&lt;p style=\"line-height: 9%\"&gt;&lt;span style=\"font-size: 1; letter-spacing: -1\"&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>    for($s=1;$s&lt;=$height-1;$s++){</FONT></CODE><LI><CODE><FONT face=新宋体>      for($i=1;$i&lt;=$width-1;$i++){</FONT></CODE><LI><CODE><FONT face=新宋体>            $as=<A href="http://www.php.net/manual/zh/function.imagecolorat"><U><FONT color=#0000ff>imagecolorat</FONT></U></A>($im,$i,$s);</FONT></CODE><LI><CODE><FONT face=新宋体>            echo "&lt;font color=#".<A href="http://www.php.net/manual/zh/function.dechex"><U><FONT color=#0000ff>dechex</FONT></U></A>($as)."&gt;".$zf."&lt;/font&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>      }</FONT></CODE><LI><CODE><FONT face=新宋体>      echo "&lt;br&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>    }</FONT></CODE><LI><CODE><FONT face=新宋体>    <A href="http://www.php.net/manual/zh/function.ImageDestroy"><U><FONT color=#0000ff>ImageDestroy</FONT></U></A>($im);</FONT></CODE><LI><CODE><FONT face=新宋体>    echo "&lt;/font&gt;&lt;/p&gt;";</FONT></CODE><LI><CODE><FONT face=新宋体>}</FONT></CODE><LI><CODE><FONT face=新宋体>htmlimg('01image.jpg');</FONT></CODE><LI><CODE><FONT face=新宋体>?&gt;</FONT></CODE></LI></OL>
页: [1]
查看完整版本: 将图片转为html格式