public function setImageOptions($ext = null, $size = null) { $this->getValidator()->setAllowedExtensions($ext ? $ext : ImageUploadField::config()->default_allowed_extensions); $sizeInBytes = $size ? $size : ImageUploadField::config()->default_max_file_size * 1024 * 1024; $this->getValidator()->setAllowedMaxFileSize($sizeInBytes); return $this; }