VanGans

Base64 IMG Encode

Apr 19th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <form name="data" method="post">
  2. <textarea name="url" style="height:250px;width:500px"  placeholder="Input your image url"></textarea><br><br>
  3. <input type="submit" name='go' value="GASCOK">
  4. <input type="reset"  value="CANCEL">
  5.  
  6. <?php
  7. error_reporting(E_ALL ^ ( E_NOTICE | E_WARNING ));
  8. $ya=$_POST['go'];
  9. $co=$_POST['url'];
  10.  
  11. if($ya){
  12. $image = ($co);
  13. $type = pathinfo($image, PATHINFO_EXTENSION);
  14. $data = file_get_contents($image);
  15. $dataUri = 'data:image/' . $type . ';base64,' . base64_encode($data);
  16. echo"<center><textarea cols='50' rows='12'>$dataUri</textarea></center>";  
  17. }
  18. ?>
Add Comment
Please, Sign In to add comment