laravel image ratio validation

Solutions on MaxInterview for laravel image ratio validation by the best coders in the world

showing results for - "laravel image ratio validation"
Tommaso
01 Oct 2016
1// ImageController
2public function postImage(Request $request)
3{
4  $this->validate($request, [
5    'avatar' => 'dimensions:min_width=250,min_height=500'
6  ]);
7
8  // or... 
9
10  $this->validate($request, [
11    'avatar' => 'dimensions:min_width=500,max_width=1500'
12  ]);
13
14  // or...
15
16  $this->validate($request, [
17    'avatar' => 'dimensions:width=100,height=100'
18  ]);
19
20  // or...
21
22  // Ensures that the width of the image is 1.5x the height
23  $this->validate($request, [
24    'avatar' => 'dimensions:ratio=3/2'
25  ]);
26}
27