当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtils::uploadPhotoModel方法代码示例

本文整理汇总了PHP中FileUtils::uploadPhotoModel方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::uploadPhotoModel方法的具体用法?PHP FileUtils::uploadPhotoModel怎么用?PHP FileUtils::uploadPhotoModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtils的用法示例。


在下文中一共展示了FileUtils::uploadPhotoModel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addPhotoModel

 function addPhotoModel($photoForm, $albumId)
 {
     $formObjRaw = new FormDTO(ADD_PHOTO_FORM, $photoForm);
     $responseDTO = new ResponseDTO(ADD_PHOTO_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(ADD_PHOTO_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[ADD_PHOTO_FORM . PHOTO], $albumId, ADD_PHOTO_FORM, $formDataObj[ADD_PHOTO_FORM . LATITUDE], $formDataObj[ADD_PHOTO_FORM . LONGITUDE]);
             if (get_class($uploadedPhoto) === PHOTODTO) {
                 DataModelUtils::notifyAction($uploadedPhoto->getPhotoId() . SEPARATOR . $uploadedPhoto->getPhotoUrl() . SEPARATOR . $albumId, ADD_PHOTO_FORM);
                 return $uploadedPhoto;
             } else {
                 $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto");
             }
         } else {
             if (array_key_exists(PHOTO, $validationError)) {
                 $responseDTO->setErrField(PHOTO, $validationError[PHOTO]);
             }
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:30,代码来源:Photo_model.php

示例2: addAlbumModel

 function addAlbumModel($albumForm)
 {
     $formObjRaw = new FormDTO(ADD_ALBUM_FORM, $albumForm);
     $responseDTO = new ResponseDTO(ADD_ALBUM_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(ADD_ALBUM_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         //            $validationError = array();
         if (sizeof($validationError) == 0) {
             $userLogged = SessionUtils::getUserLogged();
             $uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[ADD_ALBUM_FORM . COVER], NULL, ADD_ALBUM_FORM);
             if (get_class($uploadedPhoto) === PHOTODTO) {
                 $userDAO = new UserDAO();
                 $userDTO = $userDAO->getUserByUserId($userLogged->getUserId());
                 $albumDAO = new AlbumDAO();
                 $albumDTO = new AlbumDTO(null, date(DATE_FORMAT), $formDataObj[ADD_ALBUM_FORM . TITLE], $uploadedPhoto, $userDTO);
                 $albumDTO = $albumDAO->insertNewAlbum($albumDTO);
                 if ($albumDTO->getAlbumId() != 0) {
                     $photoAlbumPath = FileUtils::createAlbumDirOnServer($userDTO->getUserId(), $albumDTO->getAlbumId());
                     DataModelUtils::notifyAction($albumDTO->getCover()->getPhotoId() . SEPARATOR . $albumDTO->getCover()->getPhotoUrl() . SEPARATOR . $albumDTO->getAlbumId() . SEPARATOR . $albumDTO->getTitle(), ADD_ALBUM_FORM);
                     return $albumDTO;
                 } else {
                     $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento dell'album");
                 }
             } else {
                 $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'inserimento della foto profilo");
             }
         } else {
             if (array_key_exists(TITLE, $validationError)) {
                 $responseDTO->setErrField(TITLE, $validationError[TITLE]);
             }
             if (array_key_exists(PHOTO, $validationError)) {
                 $responseDTO->setErrField(COVER, $validationError[PHOTO]);
             }
             SessionUtils::setFormValue($formDataObj);
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:46,代码来源:Album_model.php

示例3: writeAPostModel

 public function writeAPostModel()
 {
     $responseDTO = new ResponseDTO(WRITE_POST_FORM);
     $formObjRaw = new FormDTO(WRITE_POST_FORM, NULL);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(WRITE_POST_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[WRITE_POST_FORM . PHOTO], NULL, WRITE_POST_FORM, $formDataObj[WRITE_POST_FORM . LATITUDE], $formDataObj[WRITE_POST_FORM . LONGITUDE]);
             $uploadedPost = $this->saveNewPost($uploadedPhoto, $formDataObj);
             if (get_class($uploadedPost) === POSTDTO) {
                 return $uploadedPost;
             } else {
                 $responseDTO->setErrField(ADDRESS, "Errore durante l'inserimento del post");
             }
             return $responseDTO;
         } else {
             if (array_key_exists(TEXT, $validationError)) {
                 $responseDTO->setErrField(TEXT, $validationError[TEXT]);
             }
             if (array_key_exists(PHOTO, $validationError)) {
                 $responseDTO->setErrField(PHOTO, $validationError[PHOTO]);
             }
             if (array_key_exists(ADDRESS, $validationError)) {
                 $responseDTO->setErrField(ADDRESS, $validationError[ADDRESS]);
             }
             SessionUtils::setFormValue($formDataObj);
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:38,代码来源:Profile_model.php

示例4: changeUserProfilePhoto

 function changeUserProfilePhoto($photoForm)
 {
     $formObjRaw = new FormDTO(PROFILE_SETTINGS_PHOTO_FORM, $photoForm);
     $responseDTO = new ResponseDTO(PROFILE_SETTINGS_PHOTO_FORM);
     try {
         $formDataObj = $formObjRaw->getFormData();
         $validator = new FormValidator(PROFILE_SETTINGS_PHOTO_FORM, $formDataObj);
         $validationError = $validator->checkAll();
         if (sizeof($validationError) == 0) {
             $userLogged = SessionUtils::getUserLogged();
             $uploadedPhoto = FileUtils::uploadPhotoModel($formDataObj[PROFILE_SETTINGS_PHOTO_FORM . PHOTO], $userLogged->getDefaultAlbumId(), PROFILE_SETTINGS_PHOTO_FORM);
             if (get_class($uploadedPhoto) === PHOTODTO) {
                 $photoDAO = new PhotoDAO();
                 $updateProfilePhoto = $photoDAO->updateProfilePhoto($uploadedPhoto);
                 $userLogged = SessionUtils::getUserLogged();
                 $userLogged->setProfilePhoto($uploadedPhoto);
                 SessionUtils::setUserLogged($userLogged);
                 return $uploadedPhoto;
             } else {
                 $responseDTO->setResponseSucc("Errore durante l'inserimento della foto profilo");
             }
         } else {
             if (array_key_exists(PHOTO, $validationError)) {
                 $responseDTO->setErrField(PHOTO, $validationError[PHOTO]);
             }
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sbadi,项目名称:shareatrip,代码行数:35,代码来源:ProfileSettings_model.php


注:本文中的FileUtils::uploadPhotoModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。