• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

I want to display default profile image if user do not have profile image

php


PHP Snippet 1:

if(!empty($path)){
  $path='<img src="/image/'.$image.'"/>';
} else {
  $path='<img src="/image/default.jpg"/>';
}

PHP Snippet 2:

<div>

  @if($user)
  <img src="{{ $user['user_avatar'] ? $user['user_avatar']:'default_profile_image' }}" alt="user image">

  @else
  <img src="default_profile_image" alt="user image">
  @endif

</div>

Related Snippets

Sliders in Laravel

Combine array with same value and add other [duplicate]

Find out the name of the last script that included the current one

using random function but it's displaying duplicates

Target Laravelista is not instantiable

Laravel 5.2: Unable to locate factory with name [default]

How to pass data to all views in Laravel 5?

woocommerce get_order_report_data to show order_item_id

Clear javascript source cache laravel 5.8

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Implode array with array of glue strings

(Cache::lock()) -> get() -- Under what conditions does it return false?

Destroy session upon refresh

About Contact Privacy policy Terms and conditions