thephpleague / glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.
http://glide.thephpleague.com
MIT License
2.55k stars 199 forks source link

Glide Server doesn't generate images and doesn't tell me why #250

Closed benjamincrozat closed 5 years ago

benjamincrozat commented 5 years ago

Hello,

I'm experimenting with Glide in my Laravel based project and I didn't manage to make it work so far.

Here is my server configuration:

\League\Glide\ServerFactory::create([
    'cache'              => Storage::disk('local')->getDriver(),
    'cache_path_prefix'  => 'photos/.cache',
    'response'           => new \League\Glide\Responses\LaravelResponseFactory(request()),
    'source'             => Storage::disk('local')->getDriver(),
    'source_path_prefix' => 'photos',
]);

Once I hit my route (/some-route?w=640&h=480), I get a white page, a 500 HTTP code, text/html content but nothing tells me why. Nothing on screen, nothing in the log. It seems like my Glide server configuration is good, since I get actual error messages when I use wrong path prefixes.

After messing a little bit with Glide's code, it looks like this part in Server::makeImage() causes problems:

try {
    dump('Works');

    $write = $this->cache->write(
        $cachedPath,
        $this->api->run($tmp, $this->getAllParams($params))
    );

    dump('Never hits this dump');

    if (false === $write) {
        throw new FilesystemException(
            'Could not write the image `' . $cachedPath . '`.'
        );
    }
} catch (FileExistsException $exception) {
    // This edge case occurs when the target already exists
    // because it's currently be written to disk in another
    // request. It's best to just fail silently.
}

I tried removing the try / catch block, changing the cache path prefix in the server configuration but it still fails silently.

Anybody here having a clue? Could it be an issue with GD? Is there a recommended configuration?

Thanks in advance.

benjamincrozat commented 5 years ago

Seems like an issue with gd not handling 24 megapixels (+10MB) JPEGs.