Esempio n. 1
0
 /**
  * Index action.
  *
  * @param string $part1
  * @param string $part2
  * 
  * @return mixed
  */
 public function getIndex($part1 = null, $part2 = null)
 {
     $size = empty($part2) ? null : $part1;
     $filename = empty($part2) ? $part1 : $part2;
     if (!($image = Image::where('filename', $filename)->first())) {
         App::abort(404);
     }
     if (!($path = $image->path($size))) {
         App::abort(404);
     }
     return Storage::render($path);
 }
Esempio n. 2
0
<?php

use Dmyers\Storage\Storage;
if ($route_path = Storage::config('route_path', false)) {
    // Register storage route.
    \Route::get($route_path . '{path}', function ($path) {
        try {
            $response = Storage::render($path);
        } catch (\Exception $e) {
            \App::abort(404, 'File not found');
        }
        return $response;
    });
}