• 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

How do I remove this delivery notification from here?

How can I format this number correctly using PHP?

Open a popup box after receiving result from ajax

Transfer data between JavaScript and PHP through JSON

generate an Excel file using PHP

Testing subscription renewals on Stripe

Additional price based on cart item count in WooCommerce

Fetch files from next cloud storage and display in Laravel website

How to disable widget block editor of WordPress?

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

Sentry on Symfony: how to exclude `NotFoundHttpException`

calling server using nusoap with complextype

Target Laravelista is not instantiable

How to make a array inside array?

Return multiple values from a function using mysqli_fetch_assoc [closed]

About Contact Privacy policy Terms and conditions