Home > Blockchain >  laravel image optimizer file does not exists
laravel image optimizer file does not exists

Time:05-12

I am using spatie/laravel-image-optimizer package to optimize my images. I receive the error message: storage/app/public/files/car/9/km_declaration/2022/uE5DMCYh6hCuQXrOZ4yOSLCtLEnNdsE9e9OriNVw.jpg does not exist

Although the file is there, and it can access it locally, in production it cannot find it.

I am using the optimizer as it supposted to be used, and I am using the filesystem public:

ImageOptimizer::optimize($this->url);

Do you have any guess why is it working locally with homestead but not on production?

(Folder permissions 755 on prod)

Update: The code: ImageOptimizer::optimize($this->url); is run from a cron job. If I do file_exists($url) from the controller I got true, but false from the job. I think that is the source of my issue.

CodePudding user response:

In the storage folder, you need to set permissions 775 chmod -R 775 storage

  • Related