Alisam_Technology

Image64

Jun 17th, 2015
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.    <title>base64encoder</title>
  5.     <style>
  6.        h1{ color:#00FF00};
  7.        TD.main{ color:#FFF; font-size:14px; font-weight:bold;};
  8.        TD.logo{ color: #FF0; font-size:18px; font-weight:bold; };
  9.     </style>
  10. </head>
  11. <body bgcolor="#000000" text="#FFFFFF">
  12.   <table border="0" cellpadding="5" cellspacing="3" width="100%">
  13.     <tr>
  14.       <td align="center">
  15.         <h1>Image Encoder 64</h1></td>
  16.     </tr>
  17.     <tr>
  18.       <td align="center" class="logo">
  19.         <b>By Alisam@Technology</b>
  20.       </td>
  21.     </tr>
  22.     <tr>
  23.      <td align="center" class="main">
  24.        <table border="1" cellpadding="5" cellspacing="3">
  25.          <tr>
  26.            <td>
  27.              <center><form id="UploadForm" style="margin-top:3px;" action="" method="post" enctype="multipart/form-data">
  28.                Select file: <input type="file" name="myfile" size="50" />
  29.                <input type="submit" value="encode" />
  30.               </form></center>
  31.              </td>
  32.             </tr>  
  33.          </table>
  34.      </td>
  35.     </tr>
  36.   </table>
  37.   <br>
  38. <?php
  39. $b64 = '';
  40.  
  41. if(!function_exists('file_get_contents')) {
  42.     function file_get_contents($file) {
  43.         $fp = @fopen ( $file, 'rb' );
  44.         if (!$fp) exit('Unable to open '.$file);
  45.         $data = fread ( $fp, filesize ( $file ) );
  46.         fclose ( $fp );
  47.         return $data;
  48.     }
  49. }
  50.  
  51. if(isset($_FILES['myfile'])){
  52.         $coded = "data:image/gif;base64," . base64_encode(file_get_contents($_FILES['myfile']['tmp_name']));
  53.     echo "
  54.                <script>
  55.                        $(document).ready(function() {
  56.                                $(\"textarea\").focus(function() { $(this).select(); } );
  57.                        });
  58.                </script>
  59.                 <center><b>Your Image Encoded Here:</b></center><br>
  60.                <center><textarea style='width:1005px;height:100px;margin-top:10px;' onfocus=\"this.select()\" onMouseUp=\"return false\">$coded</textarea></center>
  61.                <br>
  62.                <center><img src=\"$coded\"/></center>
  63.                        <hr>
  64.              
  65.                <br>";
  66. }
  67. ?>
  68.  
  69.  </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment