MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/amanda/app/Http/Controllers/ChatImagesController.php
<?php

namespace App\Http\Controllers;

use Auth;
use File;
use App\User;
use Validator;
use Mail;
use DB;
use Illuminate\Http\Request;

use Illuminate\Support\Str;
use Illuminate\Support\Facades\Hash;


class ChatImagesController extends Controller
{
    public function showChatImage($slug)
    {
        // get the image named $slug from storage and display it

        // Something like (not sure)
        // $image = File::get(config('constants.imageFolderPath').'documents/' . $slug);
     

      if (file_exists(config('constants.imageFolderPath')."/chatImage/".$slug)) {
          $image = File::get(config('constants.imageFolderPath').'/chatImage/' . $slug);
        } else {
          $image= url('img/no-image.png');
        }     
        # $image = File::get(config('constants.imageFolderPath').'/images/' . $slug);
        $ext=\File::extension($slug);
        if($ext=="jpg" || $ext=="jpeg" || $ext=="png" || $ext=="JPEG" || $ext=="JPG")
        {
            return response()->make($image, 200, ['content-type' => 'image/png']);
        }
        else{
            return response()->make($image, 200, ['content-type' => 'application/pdf']);
        }
      
    
    }


}