Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to init from given binary data

I'm trying to save image encoded by base64 using Intervention Image, laravel-5 Exception told me that "Unable to init from given binary data". anyone can help?

$png_url = "user-".time().".png";
$path = "/public/".$png_url;
Image::make(base64_encode($request['image']))->save($path);
like image 821
abdelrahman khedr Avatar asked May 19 '15 19:05

abdelrahman khedr


1 Answers

<?php
$png_url = "user-".time().".png";
$path = "/public/".$png_url;
$base=base64_decode($request['image']);
Image::make($base)->save($path);
?>
like image 165
abdelrahman khedr Avatar answered Nov 06 '22 18:11

abdelrahman khedr