• 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

Get orders by date and status woocommerce

How to Generate PDF invoice to XML format using mPDF

Reducing authentication calls on external API (Laravel 5.6)

Symfony - "framework.test" config is not set to true

Laravel Collections. Is there some kind of assertStructure method?

Having issue with matching rows in the database using PDO

WooCommerce: Add/display Product or Variation custom field everywhere

Adding the custom page with add_menu_page function on Wordpress

Laravel SQL query midnight time not showing

Laravel 8: Array to string conversion while calling route:list

Failing validation doesn't stop code execution in livewire component

PHP Slim Framework request using withAttribute error

PHP: Print caught exception like Xdebug

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

About Contact Privacy policy Terms and conditions