This article illustrates the implementation of PHP based on Base64 decoding image and encrypted image restoration. Share to everyone for your reference. The implementation methods are as follows:
In this case, $data is a base64 encoded picture. The specific code is as follows:
Copy Code code as follows:
<?php
FileName: base64.php
$data = "/9j/4aaqskzjrgabaqaaaqabaad/ 2wceabalda4mchaodq4seratgcgagbywgdejjr0oojm9pdkzoddasfxoqerxrtc4ug1rv19iz2hnpk1xexbkefxlz2mberisgbuylxoal2ncoejjy2njy2njy 2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy2njy//aabeiadiamgmbeqaceqedeqh/ Xagiaaabbqebaqebaqaaaaaaaaaaaqidbaugbwgjcgsqaaibawmcbamfbqqeaaabfqecawaeequsitfbbhnryqcicrqygzghccncscevuthwjdnicoijchyxg Bkajsynkckqndu2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6g4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiyc rs09tv1tfy2drh4upk5ebn6onq8flz9px29/j5+ Geaawebaqebaqebaqaaaaaaaaecawqfbgcicqoleqacaqiebamebwuebaabancaaqideqqfitegekfrb2fxeyiygqguqpghscejizns8bvictekfiq04sxxfx Gzgiynkckqnty3odk6q0rfrkdisuptvfvwv1hzwmnkzwznaglqc3r1dnd4exqcg4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiycr s09tv1tfy2dri4+tl5ufo6ery8/t19vf4+fr/2gamaweaahedeqa/aj9z1g8i1e5so6mrfbavxia4oaqdvl//aj/j/wdvs0ai2qx/apz+z/ 8afw0arnq2of8ap7cf9/dqbe2sakol/cf9/dqbc2s6mp8amixp/f00aen27fremkkkqcfyoa4hxjjw7v8a3/6cgbdk0q41qs/ Z3jxy8z3kjrn0b9kalsnhs/wnmmtudojwgbp/akdqbzrggcfzqba5oa9etv8aj1h/3b/kgdz7xa2ndu/9/wdokanrwss0v+bycj/7nqbktanq0mlyyw7qikwy7xwb170atw+ j219oet5aysm6hb3xkgjjk44z06uaqxuk29joen3cysi7n5jibaahxj4z0/mkaodc0wpybx/j1h/3f/lsa858rtjx7z/f/ okanvwm37nusoocfyagdal1vuzy2jkvjwrgqylucd2oa2pcg+zgvdtncpaim0j++rzx9on40aj43gezbxu4xmlq6br6lnkh8f6uaca7uwpzbx/ j1h/3f/lsa8z8tnjxdej/ag/6cmbbyaveaasq2k3lixaf5qc4zjqpc0aui9afqxv7yttlsgmh2vmeifue/jayaae/tu/xttp/ ng2pbgxku989sm9aqgu70ae12v8ax6w/7i/yoa8w8uk//cr3ueyjf2hskygxtk/55v8akaaarj/zzb8jqawrj/zzf8jqbgysn/lm/ wd3yaqdfjlp/ln/++tqb7zag/zyep4f/lqa9o0lelfj9xqavlr/880/75fab5uf/pnp++rqaevh/wa80/75fab5uf8azzt/al5fma8qp/nmn/ Fioacbxsa//9k= ";
$img =base64_decode ($data);
Echo $img;
?>
How to refer to a picture:
Copy Code code as follows:
The effect is as shown in the following illustration:
PS: About encryption technology, the site also provides the following encryption tools for your reference to use:
picture converted to BASE64 encoded online tool: http://tools.jb51.net/transcoding/img2base64
MD5 Online encryption tool:Http://tools.jb51.net/password/CreateMD5Password
Escape Encryption/Decryption tool:http://tools.jb51.net/password/escapepwd
Online SHA1 encryption tool:Http://tools.jb51.net/password/sha1encode
short link (short URL) online generation tool:http://tools.jb51.net/password/dwzcreate
short link (short URL) online restore tool:Http://tools.jb51.net/password/unshorturl
High Strength Password generator:Http://tools.jb51.net/password/CreateStrongPassword
I hope this article will help you with your PHP program design.