• 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

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

woocommerce_wp_select options array from product attribute terms

Dynamic table in HTML using MySQL and php

Show date difference as "20" instead of "20 years ago"

PHPExcel export HTML table to xlsx

if statement inside concatenation

dockerizing Laravel + vue

Load a .env file with PHP

PHP: How to solve ob_start() in combination imagepng() issue?

How can I make a full text index of the column?

Transpose multidimensional array and join values with commas

Change user role if checkout custom checkbox is checked in WooCommerce

Laravel s3 upload file with metadata using pre-signed url

Error Class "LaravelFortifyFeatures" not found

PHP and WebView - Cookie doesn't are the same

About Contact Privacy policy Terms and conditions