Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matt Stauffer:
Image dimension validation rules in Laravel 5.3
Jul 26, 2016 @ 14:09:18

Continuing his series looking at the features coming in Laravel 5.3, Matt Stauffer has posted his latest article in the series covering some of the image validation rules that the update will include.

In Laravel 5.3, we have a new validation option: image dimensions for image uploads. The validation rule is called dimensions, and you can pass the following parameters to it: min_width, max_width, min_height, max_height, width, height and ratio.

This provides a simplified version of many of these checks you might have been doing manually in the past (and fits in with the Laravel validation structure). He gives a few examples of verifying images from a basic form submission. The validations are put on the "avatar" field and work much like the other validation definitions with the checks "stacked" and separated by the pipe character ("|").

tagged: laravel v53 feature image dimension validation rules

Link: https://mattstauffer.co/blog/image-dimension-validation-rules-in-laravel-5-3


Trending Topics: