Wednesday, September 11, 2013

Image ENCODING using Base64


Base64 is an encoding format that represent binary data.Now a days lot of website use binary encription scheme to secure their image link from user. Google,facebook etc using this method to encript their image link.


use following code:



        <?php
         $img_src = "s.png";    // add image link
         $imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
        $img_str = base64_encode($imgbinary);               //image encoding
        echo '<img src="data:image/jpg;base64,'.$img_str.'" />';
         ?>


No comments:

Post a Comment