• 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 restriction to WooCommerce coupons by allowed user ID

PHP Array split string and Integers

file_get_contents() without "Http" to access external URL [closed]

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

How do I do HTTP basic authentication using Guzzle?

how to fix Service provider class not found when using repository?

Pass an image through AJAX [duplicate]

Natural ORDER in Laravel Eloquent ORM

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Adding reCAPTCHA v2 into my PHP file

Laravel Passport - Not able to get token string in response?

get attribute from class not working php 7

php echo xml documents with header

PDOException SQLSTATE[HY000] [2002] No such file or directory

About Contact Privacy policy Terms and conditions