Beispiel #1
0
 private function _validImage($image)
 {
     $config = CFactory::getConfig();
     if ($image['error'] > 0 && $image['error'] !== 'UPLOAD_ERR_OK') {
         $this->setError(JText::sprintf('COM_COMMUNITY_PHOTOS_UPLOAD_ERROR', $image['error']));
         return false;
     }
     if (empty($image['tmp_name'])) {
         $this->setError(JText::_('COM_COMMUNITY_PHOTOS_MISSING_FILENAME_ERROR'));
         return false;
     }
     // This is only applicable for html uploader because flash uploader uploads all 'files' as application/octet-stream
     //if( !$config->get('flashuploader') && !CImageHelper::isValidType( $image['type'] ) )
     if (!CImageHelper::isValidType($image['type'])) {
         $this->setError(JText::_('COM_COMMUNITY_IMAGE_FILE_NOT_SUPPORTED'));
         return false;
     }
     if (!CImageHelper::isMemoryNeededExceed($image['tmp_name'])) {
         $this->setError(JText::_('COM_COMMUNITY_IMAGE_NOT_ENOUGH_MEMORY'));
         return false;
     }
     if (!CImageHelper::isValid($image['tmp_name'])) {
         $this->setError(JText::_('COM_COMMUNITY_IMAGE_FILE_NOT_SUPPORTED'));
         return false;
     }
     return true;
 }