图片转ASCII码php代码

图片转ASCII码php代码:

转换有利于存储,可以直接入库的方法.获取图片参数.

 
  Ascii
  
   body{
    line-height:0;
    font-size:1px;
   }
  
 
 
   <?php
  $image = 'image.jpg';
  //CODEGO.NET Supports http if allow_url_fopen is enabled
  $image = file_get_contents($image);
  $img = imagecreatefromstring($image);
  $width = imagesx($img);
  $height = imagesy($img);
  for($h=0;$h
   for($w=0;$w<=$width;$w++){
    $rgb = imagecolorat($img, $w, $h);
    $a = ($rgb >> 24) & 0xFF;
    $r = ($rgb >> 16) & 0xFF;
    $g = ($rgb >> 8) & 0xFF;
    $b = $rgb & 0xFF;
    $a = abs(($a / 127) - 1);
    if($w == $width){
     echo '
';
    }else{
      echo ' #';
    }
   }
  }
  ?>
 
代码来自CODEGO.NET

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29974986/viewspace-1485235/,如需转载,请注明出处,否则将追究法律责任。

user_pic_default.png
请登录后发表评论 登录
全部评论
<%=items[i].createtime%>

<%=items[i].content%>

<%if(items[i].items.items.length) { %>
<%for(var j=0;j
<%=items[i].items.items[j].createtime%> 回复

<%=items[i].items.items[j].username%>   回复   <%=items[i].items.items[j].tousername%><%=items[i].items.items[j].content%>

<%}%> <%if(items[i].items.total > 5) { %>
还有<%=items[i].items.total-5%>条评论 ) data-count=1 data-flag=true>点击查看
<%}%>
<%}%> <%}%>

转载于:http://blog.itpub.net/29974986/viewspace-1485235/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值