• 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

wordpress : How to specify the cause "This site can’t be reached"

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

Laravel post contact form giving me error 419

Magento Installation SQLSTATE[HY000] [2002] No such file or directory error

Laravel 8 factory state afterCreating

Performance of foreach, array_map with lambda and array_map with static function

mysql slow on updates for a well optimized query

Match csv filenames to table names and import

Having issue with matching rows in the database using PDO

getting error while enter Command => php artisan route:list

Add and update products to session cart in Laravel

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Laravel Command Schedule Not Working Properly

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

How to override htaccees file for cache control header

About Contact Privacy policy Terms and conditions