Answers for "check image exist or not in laravel"

PHP
0

image exists in laravel

if(File::exists(public_path('images/1461177230.jpg'))){    dd('File is exists.');}else{    dd('File is not exists.');}
Posted by: Guest on May-08-2021
0

image exists in laravel

if(file_exists(public_path('images/1461177230.jpg'))){    dd('File is exists.');}else{    dd('File is not exists.');}
Posted by: Guest on May-08-2021
0

check image exist or not in laravel

// User Model
public function photo()
{
    if (file_exists( public_path() . '/images/photos/account/' . $this->account_id . '.png')) {
        return '/images/photos/account/' . $this->account_id .'.png';
    } else {
        return '/images/photos/account/default.png';
    }     
}

// Blade Template
<img src="{!! Auth::user()->photo() !!}" alt="">
Posted by: Guest on August-13-2021

Code answers related to "check image exist or not in laravel"

Browse Popular Code Answers by Language