Chinaunix

标题: php 用base64对图片加密 [打印本页]

作者: huangyu_945    时间: 2012-12-11 11:06
标题: php 用base64对图片加密
php 用base64对图片加密如何对其解密呢?

加密代码如下:
  1. <html>
  2. <head>
  3.         <title>TesT</title>
  4.         </head>
  5. <body>       
  6. <?php
  7. $file = "./image/index.png";
  8. $type = getimagesize($file);
  9. $fp = fopen($file,"r") or die("Can't open file");
  10. $file_content = chunk_split(base64_encode(fread($fp,filesize($file))));
  11. switch($type[2]){
  12.                 case 1:$img_type="gif";break;
  13.                 case 2:$img_type="jpg";break;
  14.                 case 3:$img_type="png";break;
  15.         }
  16. $img = 'data:image/'.$img_type.';base64,'.$file_content;
  17. fclose($fp);
  18. ?>
  19. <img id="img" src="<?php echo $img; ?>" />
  20. </body>
  21. </html>
复制代码

作者: linux_c_py_php    时间: 2012-12-11 16:29
decode就不会了吗.
作者: maochanglu    时间: 2012-12-17 10:24
aes 之流才算加密。。
作者: huangyu_945    时间: 2012-12-20 13:43
回复 2# linux_c_py_php
怎么用?



   




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2