• 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

PHPExcel_IOFactory::createWriter causes wrong behaviour

Changing font color in javascript

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

PHP Download MP3 files from directory on server

Laravel: Create morphs() relationship nullable

Symfony Mercure "Failed to send an update"

How to render html from a @foreach loop in a textarea

How to pass security cloudflare server with php curl

Insert database rows from columns of data from associative array of indexed arrays

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Laravel/docker-compose/redis - Class 'Redis' not found

How do I refresh a DIV content?

Convert every two values of an associative array into key-value pairs

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

About Contact Privacy policy Terms and conditions