Answers for "php base64 encode"

PHP
7

php image to base64

$path = 'myfolder/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
Posted by: Guest on October-02-2020
1

php detect base64 encoding

function is_base64_encoded($data)
{
    if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $data)) {
       return TRUE;
    } else {
       return FALSE;
    }
};

is_base64_encoded("iash21iawhdj98UH3"); // true
is_base64_encoded("#iu3498r"); // false
is_base64_encoded("asiudfh9w=8uihf"); // false
is_base64_encoded("a398UIhnj43f/1!+sadfh3w84hduihhjw=="); // false
Posted by: Guest on November-17-2019
3

how do decode base64 php

base64_decode('base64-string-goes-here');
Posted by: Guest on June-05-2020
0

base64 enocode php

<?php
$str = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==';
echo base64_decode($str);
?>
Posted by: Guest on October-13-2021
0

php base64

$base_string = base64_encode("your-string"); //for base64 encoding
echo base64_decode($base_string); //for base64 decoding
Posted by: Guest on October-20-2021
0

echo encode base64

$ echo  'linuxhint.com' | base64
Posted by: Guest on December-14-2020

Browse Popular Code Answers by Language