Unable to init from given binary data - intervention image
Hello,
I have error when I display image: Unable to init from given binary data.
$project = Project::findOrFail($id);
$path = asset('storage/projects/' . $project->n_img);
$img = Image::make($path);
return $img->fit($x, $y)->response('jpg', $quality);
I tray:
$project = Project::findOrFail($id);
$path = asset('storage/projects/' . $project->n_img);
base64_decode($path);
$img = Image::make($path);
return $img->fit($x, $y)->response('jpg', $quality);
It still does not work.
When I use the application locally in xamppie, nothing like this happens.
Hi Siusiak1000,
You did not set the
base64_decode();
to a variable.
Try this
$project = Project::findOrFail($id);
$path = asset('storage/projects/' . $project->n_img);
$path2 = base64_decode($path);
$img = Image::make($path2);
return $img->fit($x, $y)->response('jpg', $quality);
$project = Project::findOrFail($id);
$path = storage_path() . '/projects/' . $project->n_img;
$img = Image::make($path)->encode('jpg')->fit($x, $y, function ($c) {
$c->upsize();
})->save();
return $img;
When I use php version: PHP-7.0.28 or PHP-7.2.3 the problem occurred. When I use PHP-7.1.16 thats all works :)
Please or to participate in this conversation.