Skip to content

Instantly share code, notes, and snippets.

@milon
Last active October 19, 2015 08:36
Show Gist options
  • Save milon/da24e8fb0018189484ae to your computer and use it in GitHub Desktop.
Save milon/da24e8fb0018189484ae to your computer and use it in GitHub Desktop.
Laravel Image Response.md

Laravel's document root is public folder. But you often needs to put your assets like images on other folders than public. Here is an example using intervestion/image package on laravel.

Route::get('images/{name}', function($name){
	if(! file_exists(storage_path("/app/$name"))){
		return App::abort(404);
	}

	// Get the image
	$image = Image::make(storage_path("/app/$name"));

	return $image->response();
})->where('name', '.+');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment