• 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

Add rows to Single product Additional information table in WooCommerce 3.6

Remove country code from phone number?

Create a new line whenever an array value reaches more than 10 characters

Cache clear probem in Larave

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

Using array_intersect on a multi-dimensional array

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

How to run a shell as root from php (apache)

How to make a array inside array?

Phpunit partial mock + proxy Entity

Clients authentication and user authentication with laravel

How avoid Moved Permanently The document has moved here

Shopify password update using Shopify API

PHP drop down list using array's and foreach (else and for) code

Fetch files from next cloud storage and display in Laravel website

About Contact Privacy policy Terms and conditions