• 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

Make Shipping Method fields Mandatory on Woocommerce checkout page

Currently Using CodeIgniter Framework i have an Error

PHP Array split string and Integers

What is my SQL missing?

Increase value by 1 on button click

Is it possible to change the table name in the migration file-laravel

HTML and PHP in one file

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

Timber: Single post pagination does not work (wp_link_pages)

Convert PHP array into HTML tag attributes separated by spaces

Attempted to call an undefined method named "get" of class "MailController"

How to trim a video by 4 fragments to 4 seconds using the PHP-FFMpeg?

Warning: sqlite_query() expects parameter 1 to be resource, string given

Combining a describing and one array with data

How to get monthly wise data in laravel

About Contact Privacy policy Terms and conditions