-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot make Gregwar/Image working in laravel #165
Comments
If you get the fallback it's cos gregwar can't find the file. You should try to use absolute paths always. The Laravel public_path('picture/1/bacon-broccoli-egg-bites21.jpg') |
same error, but actually work with .png but not work with .jpg // wBEyifMlUNkqnRGxaPpqUU1RHpgVro1hD1aPzBEu.png #work
// wBEyifMlUNkqnRGxaPpqUU1RHpgVro1hD1aPzBEu.jpg #not work
$image = 'wBEyifMlUNkqnRGxaPpqUU1RHpgVro1hD1aPzBEu.jpg';
// filesystem.php
['articles' => [
'driver' => 'local',
'root' => storage_path('app/public/articles')
]];
#full path
var_dump( \Storage::disk('articles')->path($image) );
# /workspace/storage/app/public/articles/wBEyifMlUNkqnRGxaPpqUU1RHpgVro1hD1aPzBEu.jpg'
\Image::open( \Storage::disk('articles')->path($image) )->zoomCrop(130,75)->guess();
// cache/images/f/a/l/l/b/fallback.jpg |
You will also get the fallback image if the jpeg is unable to be opened but still exists. If you comment out the try/catch statement here, you will see what error is causing the package to be unable to open jpegs. In my case, I did not have gd properly installed. |
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 inphp artisan tinker
, but when I use it in blade template or controller I get thehttp://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:code used in blade:
the code inside
if (file_exists($file) && filesize($file)) {
never runs andfilesize()
returns NOTHING usingprint_r
ordd()
, I have no idea how to fix this, the weird thing is it works inphp artisan tinker
but NOT on the actual siteThe text was updated successfully, but these errors were encountered: