Laravel Displaying image from database



PHP Snippet 1:

<img src="{{ asset($post->image) }}" />

PHP Snippet 2:

{{ HTML::image($post->image, '', array('class' => 'image')); }}

PHP Snippet 3:

<img src="{{ asset('img/' . $post->image) }}" />

PHP Snippet 4:

public function store(Request $request)
 {
 $pages = new Appsetting();

        $pages->title = $request->input('title');
        $pages->description = $request->input('description');

        if ($request->hasfile('image')) {
            $file = $request->file('image');
            $extension = $file->getClientOriginalExtension(); // getting image extension
            $filename = time() . '.' . $extension;
            $file->move('uploads/appsetting/', $filename);

//see above line.. path is set.(uploads/appsetting/..)->which goes to public->then create
//a folder->upload and appsetting, and it wil store the images in your file.

            $pages->image = $filename;
        } else {
            return $request;
            $pages->image = '';
        }
       $pages->save();

       return redirect('pagesurl')->with('success', 'App Setting Added');
 }

PHP Snippet 5:

 public function index()
    {
        $pages = Appsetting::all();
        return view('admin.appsettings.pages', compact('pages',$pages));
    }

PHP Snippet 6:

@foreach ($pages as $page)
<td> <img src="{{ asset('uploads/appsetting/' . $page->image) }}" /> </td>
@endforeach

PHP Snippet 7:

<img src="/folder_name_path/{{$post ->image}}" />

PHP Snippet 8:

style="url(background-image: images/bg.jpg);