Support the ongoing development of Laravel.io →
Database Eloquent Blade
Last updated 2 years ago.
0

Maybe the answer Jimhill gave in this thread answers your questions, it's pretty much the same: http://laravel.io/forum/02-17-2014-how-do-you-save-image-to-database-and-display-it-on-website

He writes:

$img_data = file_get_contents($img_path);
$type = pathinfo($img_path, PATHINFO_EXTENSION);
$base64 = $base64_encode($img_data);

// save $base64 & $type into your datastore

0

Thank 3stadt but not work

0

Hello,

I am try to add base64_encode to Input::file('file') but convert for image name not the image code here

$file =base64_encode(Input::file('file'));

any help

0

Hello, I am sloved the problem and i am used this approach to save image in database code here

 $file =Input::file('file');
            $imagedata = file_get_contents($file);
            $base64 = base64_encode($imagedata);
            $oUser->avatar = $base64;
            $oUser->update();

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.