• 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

Dynamic dropdown Ajax PHP request

enable Apache http Authorization header

How to send parameters in soap request in php in __soapcall() function

wordpress : How to specify the cause "This site can’t be reached"

How to install php yaml on CentOs?

How to load Codeigniter 4 lang file into an array variable

httpd.conf on Windows: can't locate API model structure `php8_module`

Minimum order amount except for specific shipping method in WooCommerce

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

php curl_exec() Connection refused when retrieving a remote image

Store / Website Column in Magento 2 Admin Grid - Custom Module

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

PHPS source file - 403 Forbidden You don't have permission to access this resource

Star rating with half star support

Laravel Multi-language routes without prefix

About Contact Privacy policy Terms and conditions