Q:

Retrieve imaged saved in DB

I have the following problem:
Path of image is being stored to DB, but the actual file in Storage folder as a complete different name and I can't find a way to retrieve to display in view:
public function savePicture(Request $request){
if($request->hasFile('image')) {
    $image_name = $request->file('image')->getClientOriginalName();
    $image_path = $request->file('image')->store('public');
    $image = Image::make(Storage::get($image_path))->resize(320,240)->encode();
    Storage::put($image_path,$image);
    $image_path = explode('/',$image_path);
    $user_id = $request->input('user_id');
    $user = User::find(Auth::user()->id);
    $user->image = Storage::url($image_name);
    $user->save();
    return back();
} else{
    return "No file selected";
}

This is the Query to get the path, but cant make it work, because its an object and $pic->image not working in view
$imagen = DB::table('users')
            ->select('image')
            ->where('id', '=', Auth::user()->id);

return view('/tablero', [
  'posts' => $posts,
  'pic' => $image,
  ]);

My Database loos like
image: /storage/name.png
But in my Storage folder I get d7f7r87RmMy4NtCFvbJ8sQeutfC5wtsiak7GZXcn.png
I've been trying different ways to display the Image but it's not working. What am I missing?

A:

You are storing the file in the database using the file's Original Name, but saving in the storage directory under the name that's returned to you by the store method. So you could do
$user->image = $image_path;

instead of 
$user->image = Storage::url($image_name);

OR if you want to save the file's original name into both the db and storage you could do
Storage::put($image_name, $image);
$user->image = Storage::url($image_name);

