mardi 2 février 2021

Laravel S3 exists() function taking too much time to check file exists or not

I am using S3 bucket to save images.

Now I want to check if image exists then show from path 1 otherwise show from path 2.

But exists method taking approx 5 seconds minimum to check single image.

Did I have to do something additional ?

function getImagePath($type = 'sm')
{

    $imageURL = $this->rootURL. '/' .$type .'-'. $this->imageName;

    if (Storage::disk('s3')->exists($imageURL)) {  // -> This line taking too much time.
        return $imageURL;
    }else{
        return config('constant.productThumbnail') . $this->imageName;
    }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire