sheena2994

Untitled

Jun 9th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // New route for image (s3)->display complete image without any height/width
  2. Route::get('/resize/{id}', function($id){
  3.  
  4. $img = Image::make('https://s3-us-west-2.amazonaws.com/barterstore/uploads/images/'. $id)->resize(function($constraint){
  5.  
  6. $constraint->aspectRatio();
  7. });
  8.  
  9. return $img->response();
  10. });
  11.  
  12.  
  13. // New route for image (s3)->display image with height/width
  14. Route::get('/resize/{id}/{width?}/{height?}', function($id, $width=null, $height=null){
  15.  
  16. $img = Image::make('https://s3-us-west-2.amazonaws.com/barterstore/uploads/images/'. $id)->resize($width, $height, function($constraint){
  17. $constraint->aspectRatio();
  18. });
  19.  
  20. return $img->response();
  21. });
Add Comment
Please, Sign In to add comment