d13r/laravel-breadcrumbs

adding breadcrumbs.php to routes directory break dynamic image display on my site

Closed this issue · 1 comments

For displaying picture I use a url like http://openpicture.app/picture/get/597141f10574071b3b253d5a_thumbnail

It goes to a route /picture/get/{id}_{size} and call a function to return picture as response through InterventionImage.

When I put the file breadcrumbs.php to my route directory, pictures aren't displaying anymore.
I suppose Breadcrums package to add the breadcrums to the response.

But this route is not configured in the breadcrumbs.php.

routes/web.php

Route::get('/', function () {
    return view('auth/login');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::get('/album/{albumid}', 'HomeController@album')->name('album');
Route::get('/picture/{pictureid}', 'PictureController@index')->name('picture');
Route::get('/picture/get/{pictureid}_{size}/{download?}', 'PictureController@getpicture')->name('getpicture');

routes/breadcrumbs.php

<?php
// Home
Breadcrumbs::register('home', function($breadcrumbs)
{
    $breadcrumbs->push('Home', route('home'));
});

// Home > [Album]
Breadcrumbs::register('album', function($breadcrumbs, $album) {
    if ($album->parentAlbum)
        $breadcrumbs->parent('album', $album->parentAlbum);
    else
        $breadcrumbs->parent('home');

    $breadcrumbs->push($album->name, route('album', $album->id));
});

// Home > [Album] > [Picture]
Breadcrumbs::register('picture', function($breadcrumbs, $picture)
{
    $breadcrumbs->parent('album', $picture->album);
    $breadcrumbs->push($picture->pathinfo['basename'], route('picture', $picture->id));
});

getImage function :

    public function getImage(String $format) {
        //
        //retrieve the picture file and create the object
        //    
            $image = Image::make($imagepath);

        return $image->response();

        }
d13r commented

Sorry, as it says in the README, I don't offer free technical support. I suggest you try posting a question on Stack Overflow. For paid support / consultancy please email me.