Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // New route for image (s3)->display complete image without any height/width
- Route::get('/resize/{image}', function($image){
- $img = Image::make('https://s3-us-west-2.amazonaws.com/momentsbucket/uploads/images/'. $image)->resize(function($constraint){
- $constraint->aspectRatio();
- });
- return $img->response();
- });
- // New route for image (s3)->display image with height/width
- Route::get('resize/{image}/{width?}/{height?}', function($image,$width=null,$height=null){
- $img = Image::make('https://s3-us-west-2.amazonaws.com/momentsbucket/uploads/images/'.$image)->resize($width, $height, function($constraint){
- $constraint->aspectRatio();
- });
- return Response::make($img->encode('jpg'), 200, ['Content-Type' => 'image/jpeg']);
- });
- // New route for image (s3)->display blur image with height/width
- Route::get('fit/{image}/{h}/{w}', function($image,$h,$w){
- $image = Image::make('https://s3-us-west-2.amazonaws.com/momentsbucket/uploads/images/'.$image)->fit($h,$w);
- $image=$image->blur(30);
- return Response::make($image->encode('jpg'), 200, ['Content-Type' => 'image/jpeg']);
- });
Add Comment
Please, Sign In to add comment