/ */ namespace Avatar; use Zend\Mvc\MvcEvent; class Module { /** * Modify the project filter to: * - allow users to upload an optional workshop avatar and splash image * * @param MvcEvent $event the bootstrap event * @return void */ public function onBootstrap(MvcEvent $event) { $application = $event->getApplication(); $services = $application->getServiceManager(); $filters = $services->get('InputFilterManager'); $projectFilter = $filters->get('ProjectFilter'); $projectFilter->add( array( 'name' => 'avatar', 'required' => false ) ); $projectFilter->add( array( 'name' => 'project-avatar', 'required' => false, 'validators' => array( array( 'name' => 'File/MimeType', 'options' => array( 'mimeType' => 'image/jpg,image/jpeg,image/png' ) ), array( 'name' => 'File/ImageSize', 'options' => array( 'minWidth' => 128, 'minHeight' => 128, 'maxWidth' => 1024, 'maxHeight' => 1024, ), ), array( 'name' => 'File/Size', 'options' => array( 'min' => 1024, 'max' => 1024 * 1024, ) ) ) ) ); $projectFilter->add( array( 'name' => 'splash', 'required' => false ) ); $projectFilter->add( array( 'name' => 'project-splash', 'required' => false, 'validators' => array( array( 'name' => 'File/MimeType', 'options' => array( 'mimeType' => 'image/jpg,image/jpeg,image/png,image/gif' ) ), array( 'name' => 'File/ImageSize', 'options' => array( 'minWidth' => 128, 'minHeight' => 128, 'maxWidth' => 900, 'maxHeight' => 255, ), ), array( 'name' => 'File/Size', 'options' => array( 'min' => 1024, 'max' => 1024 * 1024, ) ) ) ) ); $filters->setService('ProjectFilter', $projectFilter); } public function getConfig() { return include __DIR__ . '/config/module.config.php'; } public function getAutoloaderConfig() { return array( 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, ), ), ); } }