Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $this->validatorSchema->setPostValidator(
- new sfValidatorCallback(array('callback' => array($this, 'checkSize')))
- );
- public function checkSize($validator, $values)
- {
- if(!isSet($values['logo'])) return $values;
- $maxPxSize = sfConfig::get('app_frontHal_maxPxSize');
- list($width, $height) = getimagesize($values['logo']->getTempName());
- if($width > $maxPxSize || $height > $maxPxSize)
- {
- throw new sfValidatorErrorSchema($validator, array('logo' => new sfValidatorError($validator, "Max image pixel size : $maxPxSize x $maxPxSize")));
- }
- return $values;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement