Glide library | image not loading up Glide library | image not loading up laravel laravel

Glide library | image not loading up


Don't know if you already fixed it. But we encountered the same problem a few days ago. After a long search, we found out that the error is caught by a new line in a config:

config file

So check all your config files for space or newline before openings tag. Otherwise, your response is not a valid response anymore and you will get the empty box.

If it is not a config file you need to check all the files that are loaded on the request.


the path mentioned by $source => put images there. if it is 1.jpg, then call the url server_url/img/1.jpg . img is from your route for the function you posted in question. In my case $source as well as $cache was /storage/app and i put image in it and called the route on that image. Hope this helps you.

Check this

enter image description hereThis is my code :

<?phpnamespace App\Http\Controllers;use Illuminate\Http\Request;use Illuminate\Contracts\Filesystem\Filesystem;use League\Glide\Responses\LaravelResponseFactory;use League\Glide\ServerFactory;class GlideController extends Controller{    public function show(Filesystem $filesystem, $path)    {        $server = ServerFactory::create([            'response' => new LaravelResponseFactory(app('request')),            'source' => $filesystem->getDriver(),            'cache' => $filesystem->getDriver(),            'cache_path_prefix' => '.cache',            'base_url' => 'img',        ]);        return $server->getImageResponse($path, request()->all());    }}

route :

Route::get('/img/{path}', 'GlideController@show')->where('path', '.*');

this is the content of my storage/app

enter image description here