• 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 call a php file with axios?

Cannot pass null argument when using type hinting

I cannot create a auto generated date time in mysql workbench

Warning: A non-numeric value encountered

enroll_table three field fetch to payment form to create payment field in laravel 5.5

Unable to create lockable file - Laravel 8 & PHP 8

PHP each() function replacement

How to get unique slug to same post-title for other time too?

How to remove index.php and index from the URL using htaccess | PHP

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

PHP echo values of all sub keys [duplicate]

Laravel websockets AWS EC2 - Connection failed

how to hide previous markers when new markers added in google map javascript api

Applying programmatically a coupon to an Order in WooCommerce3

How to execute sql code based on fetch array

About Contact Privacy policy Terms and conditions