Laravel-Backpack / community-forum

A workspace to discuss improvement and feature ideas, before they're actually implemented.
28 stars 0 forks source link

Image Validation #722

Closed backpack-operations closed 11 months ago

backpack-operations commented 11 months ago

Hello Team,

I just receive this on email "Hello,

in BACKPACK v6, how can I validate an image field type? Let's say I want my image only to be .png. There is a custom validator for field type upload, but what about image?

Thank you."

pxpm commented 11 months ago

Hey there @backpack-operations

Image field is a base64 encoded image. So the developer need to use special base64 validation package like: https://github.com/crazybooot/base64-validation

They can install that package with composer require crazybooot/base64-validation and here is a list of available validation rules: https://github.com/crazybooot/base64-validation#available-rules

Let me know if that solves the issue.

Cheers

tabacitu commented 11 months ago

This must solve the issue, so let's close it to keep things tidy. OP, if this doesn't solve it, please answer and we'll reopen, no problem.

Cheers!