• 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

laravel controller function parameters

Custom post type single page not working

How do I enable error reporting in Laravel?

Project structure for PHP

How to programmatically find public properties of a class from inside one of it's methods

disable two buttons after clicking another button

Symfony autowiring issues since docker update

Limit WooCommerce products in cart only from one custom taxonomy

php retrieve specific data onclick from database in a list format

I need to link Google Sheet with my Laravel

Add bold text and line break into Laravel Notification Email

json_encode turns array into an object

Laravel multi auth - Authentication user provider [] is not defined

Not able to access model in the controller mautic

Unable to Edit config.inc.php

About Contact Privacy policy Terms and conditions