• 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

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

Laravel 5 controller sending JSON integer as string

Which is faster php date functions or carbon?

How to send parameters in soap request in php in __soapcall() function

How can I make this nested location configuration use the correct path to call a php program?

CodeIgniter extend CI_URI undefined method

Make certain characters of a word from string bold

Access relation of pivot table in Laravel

Laravel php artisan serve to mimic HTTPS

Laravel Carbon throws error The format separator does not match

Prevent blank space in pdf pages (DomPdf)

PHP-Sort array based on another array?

Download & Save Zoom Recording in directory by PHP

Spam Filter in Contact Form

How can I pass the list to the component variable in Laravel?

About Contact Privacy policy Terms and conditions