Chinaunix
标题:
php 用base64对图片加密
[打印本页]
作者:
huangyu_945
时间:
2012-12-11 11:06
标题:
php 用base64对图片加密
php 用base64对图片加密如何对其解密呢?
加密代码如下:
<html>
<head>
<title>TesT</title>
</head>
<body>
<?php
$file = "./image/index.png";
$type = getimagesize($file);
$fp = fopen($file,"r") or die("Can't open file");
$file_content = chunk_split(base64_encode(fread($fp,filesize($file))));
switch($type[2]){
case 1:$img_type="gif";break;
case 2:$img_type="jpg";break;
case 3:$img_type="png";break;
}
$img = 'data:image/'.$img_type.';base64,'.$file_content;
fclose($fp);
?>
<img id="img" src="<?php echo $img; ?>" />
</body>
</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