• 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

browsersync doesn't work with XAMPP

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

Reducing authentication calls on external API (Laravel 5.6)

loop through an anchor id

How to get company posts from LinkedIn via API?

How to create a video stream from a single dynamic image in PHP

how to pass row id in href of a tag in codeigniter controller?

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Dropzone: Submit both form data and dropzone at once

I cannot create a auto generated date time in mysql workbench

Upload a file Using PHP and JavaScript

PHP Get value from JSON [duplicate]

PHP Slim Framework request using withAttribute error

Clear javascript source cache laravel 5.8

How can I make good efficent AJAX live forms with just jQuery and

About Contact Privacy policy Terms and conditions