yelnya
3 months ago

Cannot make Gregwar/Image working in laravel

Posted 3 months ago by yelnya

I installed the Gregwar/Image package ( https://github.com/Gregwar/Image ) to laravel, I changed the caching directory to $cacheDir = '/public/cache/images/';, I can generate cached image in php artisan tinker, but when I use it in blade template or controller I get the http://localhost/testsite/public/cache/images//f/a/l/l/b/fallback.jpg error url instead, I have narrowed down the problem to: Gregwar\Image\Adapter\GD and this function:

    protected function openJpeg($file)
    {
        if (file_exists($file) && filesize($file)) {
            $this->resource = @imagecreatefromjpeg($file);
        } else {
            $this->resource = false;
        }
    }

the code inside if (file_exists($file) && filesize($file)) { never runs and filesize() returns NOTHING using print_r or dd(), I have no idea how to fix this, the weird thing is it works in php artisan tinker but NOT on the actual site

Please sign in or create an account to participate in this conversation.