PHP - How to make condition if no image show image no image available Laravel -


i newbie in laravel need help.

i want make code if no image available showing no image available image, example image of no image available http://imgur.com/ppmpcka

this controller store image

public function store(createbannerrequest $request) {      $input = $request->all();     //get original file name     $filename = input::file('photo')->getclientoriginalname();     $input['photo'] =  $filename;     $banner = $this->bannerrepository->create($input);     //upload file     input::file('photo')->move($this->path, $filename);       flash::success('banner saved successfully.');      return redirect(route('banner.index')); } 

and table image code

<td>     <img src="{{ asset('img/banner/' . $banner->photo) }} " width="100px" height="100"/>         </td> 

and view http://imgur.com/a/x4udv

so if no image show no image available

you can use blade conditional

default text if no image available

<td>     @if ($banner->photo)         <img src="{{ asset('img/banner/' . $banner->photo) }} " width="100px" height="100"/>      @else         no image available     @endif        </td> 

default image if no image available

<td>     <img src="{{ asset($banner->photo ? 'img/banner/' . $banner->photo : 'default-image.png') }} " width="100px" height="100"/>      </td> 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -