Feb 19, 2015
15
Level 6
displaying static image if profile image is null
im having problem when that when there is no image upload yet from the user the last else in my view statement don't show which serve as my default image for those who dont upload image yet.
note: the image which supposed to be shown is the primary picture of the user who is currently logged in
controller `$photos = Photo::latest('created_at')->get();
$leftwings = Photo::where('user_id','=',Auth::id())->get();
$users = User::orderByRaw("RAND()")->get();
$homepage = view('profile',compact("users","photos","leftwings"));
return $homepage;
view `@foreach($leftwings as $leftwing)
@if(isset($leftwing->photo) && (!$leftwing->profileimage))
<img style="max-width:50px;max-height:50px;min-width:50px;min-height:50px;" src=<?php echo "/hleftwings/xpf1/" . Auth::user()->id ."/". $leftwing->profileimage; ?> />
@else
@if(isset($leftwing->profileimage))
<img style="max-width:50px;max-height:50px;min-width:50px;min-height:50px;" src= <?php echo "/hleftwings/xpf1/" . Auth::user()->id ."/". $leftwing->profileimage; ?> />
@else
<img style="max-width:50px;max-height:50px;min-width:50px;min-height:50px;" src="/hleftwings/xpf1/noprofile.jpg" />
@endif
@endif
@endforeach
Please or to participate in this conversation.