convert base64 to file php
$path = 'myfolder/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
function base64_to_jpeg($base64_string, $output_file) {
// open the output file for writing
$ifp = fopen( $output_file, 'wb' );
// split the string on commas
// $data[ 0 ] == "data:image/png;base64"
// $data[ 1 ] == <actual base64 string>
$data = explode( ',', $base64_string );
// we could add validation here with ensuring count( $data ) > 1
fwrite( $ifp, base64_decode( $data[ 1 ] ) );
// clean up the file resource
fclose( $ifp );
return $output_file;
}
Also in PHP:
- composer php version
- blade get string characters count
- errpr reporting in php
- carbon date from format
- don't desplay error in php
- change php format time
- date function plus 1 day php
- bu7scador con laravel
- Laravel 8 Auth Scaffolding using Inertia Jetstream
- display php errorrs
- docker lumen phpunit the request php extension dom is missing
- afiseaza id-ul sesiunii php
- create model controller migration factory laravel in one command
- console log with php on form sent
- COMPOSER_MEMORY_LIMIT=-1 Allowed memory size of 1610612736 bytes exhausted
- add datetime to datetime php
- cache DB table laravel
- $this->throwError php
- Woocommerce Get Related Products by Same Sub Category with no Repeate Same Product
- console() php
- @lang laravel blade
- create table in wordpress plugin
- add bootstrap class to checkout fields woocommerce
- check type in laravel