• 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

Display specific shipping method if woocommerce product has specific acf field value

PHP only Hit Counter?

renameColumn migration fails for existing column with columns does not exist error

CodeIgniter extend CI_URI undefined method

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Laravel Database Strict Mode

How do I call a php file with axios?

Why does array_map() with null as callback create an "array of arrays"?

How to show a popup modal in codeIgniter?

PHP - CURL using HTTPS [closed]

Render the content of default_filter.php in Joomla front-end

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

laravel MVC execution flow

Failing validation doesn't stop code execution in livewire component

loop through an anchor id

About Contact Privacy policy Terms and conditions