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;
}
}
code used in blade:
<div class="faceted_objects thumbnail_container" data-url="/pictures/album/test_324716/sorted/new/page/1/">
<?php
use Gregwar\Image\Image;
echo Image::open('public/storage/uploads/images/picture/1/bacon-broccoli-egg-bites21.jpg', 'transparent', 'center', 'center')
->zoomCrop(100, 100)
->jpeg();
?>
{{--{{ gregwar_image( 100, 100, 'zoomCrop', 'picture/1/bacon-broccoli-egg-bites21.jpg' ) }}--}}
{!! $image->getOtherImages() !!}
</div>
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