im trying to enable this library for my localhost environment.
http://glide.thephpleague.com/1.0/config/integrations/laravel/
Current Laravel Version 5.5
gd2
is enabled in wamp extensions.
I cant seem to find where the problem is.
Path is ok, image exists on it.
See following code for server config.
$server = ServerFactory::create([
'response' => new LaravelResponseFactory(app('request')),
'source' => $source,
//'cache' => new Filesystem(new Adapter('../storage/app/cache/')),
'cache' => $cache,
'cache_path_prefix' => '.cache',
'base_url' => 'transform-img',
]);
now i use this
return $server->getImageResponse($path, request()->all());
it does not give any error.
when i dd()
this, i get this response.
StreamedResponse {#1151 ▼
#callback: Closure {#1177 ▶}
#streamed: false
-headersSent: false
+headers: ResponseHeaderBag {#1176 ▶}
#content: null
#version: "1.0"
#statusCode: 200
#statusText: "OK"
#charset: null
}
Callback Closure:
#callback: Closure {#1252 ▼
class: "League\Glide\Responses\SymfonyResponseFactory"
this: LaravelResponseFactory {#1231 …}
use: {▼
$stream: stream resource @543 ▼
timed_out: false
blocked: true
eof: false
wrapper_type: "plainfile"
stream_type: "STDIO"
mode: "rb"
unread_bytes: 0
seekable: true
uri: "D:\wamp\www\Bankrolla\storage\app/public\.cache/img/logo_no_text.png/32c8e67d979eab40a7ef6d1854f1f7cc"
options: []
}
}
file: "D:\wamp\www\Bankrolla\vendor\league\glide-symfony\src\Responses\SymfonyResponseFactory.php"
line: "48 to 54"
}
as statusCode shows 200
and there is no error for file not found, still it does not load any image but shows a placeholder on browser when i navigate.
What can be the issue. if i try to replace image name with any other random string i get error for image not found. so this means it does find the image. thou it fails to render the image.
I have googled, searched on their github comments, could not find any problem similar as mine.
I only get a blank page/image if i load it directly.
also i looked in to the cache directory, it includes the files and those files dimensions are resized. so i am not sure where it goes wrong even when it generates the cache files.
may be i am missing any point here, if anyone can point me to the right direction would be very helpful.
Update:
Value of $source
variable:
Filesystem {#1225 ▼
#adapter: Local {#1226 ▼
#pathSeparator: "\"
#permissionMap: array:2 [▼
"file" => array:2 [▼
"public" => 420
"private" => 384
]
"dir" => array:2 [▼
"public" => 493
"private" => 448
]
]
#writeFlags: 2
-linkHandling: 2
#pathPrefix: "D:\wamp\www\Bankrolla\storage\app/public\"
}
#plugins: []
#config: Config {#1229 ▼
#settings: []
#fallback: null
}
}
Storage Directory in my public directory(its a symbolic link of original storage)
Storage Directory of Laravel
The URL i am calling this from.
{localhostDomainHere}/image/img/logo_no_text.png?w=100&h=100&fit=crop-center
Glide enables effective loading and caching of images. You can load images from a variety of sources such as files URIs, Android resources, bitmaps, drawables, etc. Just use the load() method to receive images.
You click sync in Glide If you are building your project in Glide and need to see the latest data from your data source, you can click the sync button.
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With