Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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);
Comment

php base64 encoded image to png

$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = "images/" . uniqid() . '.png';
$success = file_put_contents($file, $data);
Comment

PREVIOUS NEXT
Code Example
Php :: check table exists in db laravel 
Php :: php get ip address 
Php :: how to get last array element in php 
Php :: logout php 
Php :: display errors in codeigniter 
Php :: wordpress get particular page content programmatically 
Php :: php ip address of visitor 
Php :: php set error log file 
Php :: strtolower php 
Php :: localhost install new plugin ftp wp 
Php :: wordpress custom loop 
Php :: wp+get feature image 
Php :: force https redirection laravel 
Php :: carbon parse sunday 30 days ago 
Php :: iconify cdn 
Php :: php ping test 
Php :: carbon now format 
Php :: decode jwt token laravel 
Php :: how to echo line number in php 
Php :: get site url with protocol in php 
Php :: php print top n of array 
Php :: laravel middleware route group 
Php :: wordpress echo the page title 
Php :: remove html tags from a string except p in php 
Php :: get last slash value in php 
Php :: php right characters 
Php :: laravel 8 plural singular 
Php :: first letter capital of every word in php 
Php :: php get number from string 
Php :: how to remove jstream package 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =