• 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

xdebug 3 not working in ubuntu 20.04 with docker

Last order would be re-order in wooCommerce. How is it possible?

How to execute sql code based on fetch array

PHP: Insert marker every 3 iterations

Destroy session upon refresh

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

Populate Dynamic Dropdowns List in Codeigniter

How to edit Records using CodeIgniter

get data-value with variable value

How to properly start Laravel 8 with Bootstrap & authentication

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Get latest Tweets - What API

Display Link Title Instead of URL in XSL

Yii2: How do I debug console commands?

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

About Contact Privacy policy Terms and conditions