We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello Is there an option to check image width and height?
The text was updated successfully, but these errors were encountered:
I hacked up something like this bellow
public function validate_image_size($field, $input, $param = null) { if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { $size = explode(';', $param); $image_info = getimagesize($input[$field]['tmp_name']); if(($image_info[0] <= $size[0]) && $image_info[1] <= $size[1]) { return; } return array( 'field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param, ); } }
and validation rule:
$this->validate->validation_rules(array( 'file' => 'required_file|image_size,768;90' ));
Sorry, something went wrong.
Is it not beter to make a new function for this with gump::add_validator? because when you update your script the changes are gone.
GUMP::add_validator('image_size', function ($field, $input, $param){ if (!isset($input[$field])) { return; } if (is_array($input[$field]) && $input[$field]['error'] !== 4) { $size = explode(';', $param); $image_info = getimagesize($input[$field]['tmp_name']); if(($image_info[0] <= $size[0]) && $image_info[1] <= $size[1]) { return; } return [ 'field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param, ]; } });
No branches or pull requests
Hello
Is there an option to check image width and height?
The text was updated successfully, but these errors were encountered: