• 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

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

OAuth2 Token PHP

How do I upload a laravel project on cPanel shared hosting?

How can I make Laravel return a custom error for a JSON REST API

How to get array values using foreach in laravel

PHP web3 ERC20 token function call

Batch request Google Calendar php API

Debugging Stripe Webhook Event

Get WooCommerce products from specific category

Can't call javascript alert alertify library from PHP

Reload parent page after submit in iframe

401 Unauthorized only occurring on some pages in Laravel 8

browsersync doesn't work with XAMPP

How to use $this->session->set_userdata in codeigniter

Laravel Excel::store file empty after stored

About Contact Privacy policy Terms and conditions