You’ll see an illustration of Laravel 9 image validation rules in this article. I gave a brief explanation on laravel 9 image validation. Laravel 9 image validation size will be used. This post covers Laravel 9 image validation mimes in detail. Check out the example laravel 9 image width and height below.
Laravel 9 provides list of default image validation rules to prevent user.
- image
- mimes
- dimensions
- max
The file types “jpg,png,jpeg,gif,svg” and “max” can be defined using the aforementioned validation criteria, and the file size limit can be set using max. You can limit file height and width using dimensions. Let’s look at the following straightforward sample code.
Example:
$this->validate($request, [
'image' => ['required',
'image',
'mimes:jpg,png,jpeg,gif,svg',
'dimensions:min_width=100,min_height=100,max_width=1000,max_height=1000',
'max:2048'],
]);

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.
[…] https://www.devopsconsulting.in/blog/image-validation-rule-example/ […]
[…] Image Validation Rule Example […]