• 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

oauth-private.key does not exist or is not readable

Unit (real unit test) of test laravel relationship

How to upload mpdf file after generating to s3 bucket in php

Which is faster php date functions or carbon?

How to change 'users' auth table and use another instead Laravel

PHP Get value from JSON [duplicate]

Install mysql client in docker image

jQuery Ajax Post with data

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

WordPress Subquery returns more than 1 row on SELECT

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

PHP array stringify

Artisan, creating tables in database

Telegram bot doesn't answer

How to check user Permissions using Custom Middleware in Laravel

About Contact Privacy policy Terms and conditions