Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>base64encoder</title>
- <style>
- h1{ color:#00FF00};
- TD.main{ color:#FFF; font-size:14px; font-weight:bold;};
- TD.logo{ color: #FF0; font-size:18px; font-weight:bold; };
- </style>
- </head>
- <body bgcolor="#000000" text="#FFFFFF">
- <table border="0" cellpadding="5" cellspacing="3" width="100%">
- <tr>
- <td align="center">
- <h1>Image Encoder 64</h1></td>
- </tr>
- <tr>
- <td align="center" class="logo">
- <b>By Alisam@Technology</b>
- </td>
- </tr>
- <tr>
- <td align="center" class="main">
- <table border="1" cellpadding="5" cellspacing="3">
- <tr>
- <td>
- <center><form id="UploadForm" style="margin-top:3px;" action="" method="post" enctype="multipart/form-data">
- Select file: <input type="file" name="myfile" size="50" />
- <input type="submit" value="encode" />
- </form></center>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- <br>
- <?php
- $b64 = '';
- if(!function_exists('file_get_contents')) {
- function file_get_contents($file) {
- $fp = @fopen ( $file, 'rb' );
- if (!$fp) exit('Unable to open '.$file);
- $data = fread ( $fp, filesize ( $file ) );
- fclose ( $fp );
- return $data;
- }
- }
- if(isset($_FILES['myfile'])){
- $coded = "data:image/gif;base64," . base64_encode(file_get_contents($_FILES['myfile']['tmp_name']));
- echo "
- <script>
- $(document).ready(function() {
- $(\"textarea\").focus(function() { $(this).select(); } );
- });
- </script>
- <center><b>Your Image Encoded Here:</b></center><br>
- <center><textarea style='width:1005px;height:100px;margin-top:10px;' onfocus=\"this.select()\" onMouseUp=\"return false\">$coded</textarea></center>
- <br>
- <center><img src=\"$coded\"/></center>
- <hr>
- <br>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment