Created
October 24, 2021 11:20
-
-
Save githubcom13/b52d17942882c520f83f4a0382e92207 to your computer and use it in GitHub Desktop.
Icon base64encode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'] ) ) | |
{ | |
$b64 = base64_encode ( file_get_contents ( $_FILES['myfile']['tmp_name'] ) ); | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Icon base64encode</title> | |
</head> | |
<body> | |
<h1>Icon base64encode</h1> | |
<p>Select icon file (GIF image)</p> | |
<form action="" method="post" enctype="multipart/form-data"> | |
<input id="file" name="myfile" type="file"> | |
<input type="submit" value="Encode"> | |
</form> | |
<?php if ( $b64 != '' ) : ?> | |
<br><br> | |
<textarea style="width: 500px;height: 400px;"><?=$b64?></textarea> | |
<?php endif; ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment