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


PHP Photo::getErrors方法代码示例

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


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

示例1: actiongoPhotoFB

 public function actiongoPhotoFB()
 {
     ignore_user_abort(1);
     set_time_limit(0);
     $urlPhoto = $_POST['urlPhoto'];
     $f = $_POST['filter'];
     $capPhoto = $_POST['capPhoto'];
     Helper::debugConsole("post ok");
     $namePhoto = Helper::getLastPath($urlPhoto);
     $min_rand = rand(0, 1000);
     $max_rand = rand(100000000000, 10000000000000000);
     $name_file = rand($min_rand, $max_rand);
     //this part is for creating random name for image
     $ext = end(explode(".", $namePhoto));
     //gets extension
     $file = Yii::app()->request->baseUrl . "photo/" . $name_file . "." . $ext;
     // Save Photo From Facebook And Add Filter
     Helper::save_image($urlPhoto, $file);
     $filter = Instagraph::factory($file, $file);
     $filter->{$f}();
     Helper::debugConsole("Save Photo From Facebook And Add Filter ok");
     // 320 Show Preview
     $immid = new Imagick($file);
     if ($immid->getimagewidth() > 320) {
         $immid->thumbnailImage(320, null);
         $immid->writeImage(Yii::app()->request->baseUrl . "thumb/thumb320_" . $name_file . "." . $ext);
         $immid->destroy();
         chmod(Yii::app()->request->baseUrl . "thumb/thumb320_" . $name_file . "." . $ext, 0777);
     } else {
         $immid->writeImage(Yii::app()->request->baseUrl . "thumb/thumb320_" . $name_file . "." . $ext);
         $immid->destroy();
         chmod(Yii::app()->request->baseUrl . "thumb/thumb320_" . $name_file . "." . $ext, 0777);
     }
     Helper::debugConsole("320 Show Preview ok");
     // null x 230 show last upload
     $imlast = new Imagick($file);
     $imlast->thumbnailimage(null, 230);
     $imlast->writeImage(Yii::app()->request->baseUrl . "thumb/thumb230_" . $name_file . "." . $ext);
     $imlast->destroy();
     chmod(Yii::app()->request->baseUrl . "thumb/thumb230_" . $name_file . "." . $ext, 0777);
     Helper::debugConsole("null x 230 show last upload ok");
     // 130 x 110 thumbmail
     $im = new Imagick($file);
     $im->thumbnailImage(130, 110);
     $im->writeImage(Yii::app()->request->baseUrl . "thumb/thumb_" . $name_file . "." . $ext);
     chmod(Yii::app()->request->baseUrl . "thumb/thumb_" . $name_file . "." . $ext, 0777);
     $im->destroy();
     Helper::debugConsole("130 x 110 thumbmail ok");
     $photo = new Photo();
     $photo->link = $file;
     $photo->fbid = Yii::app()->facebook->getUser();
     $photo->ip = $_SERVER['REMOTE_ADDR'];
     Helper::debugConsole("set data ok");
     if ($photo->save()) {
         $id = $photo->id;
         $cr = "\n" . "http://www.pla2gram.com/?p=" . $id . "&theater=1";
         $capFB = $capPhoto . $cr;
         Helper::debugConsole("set fb ok");
         // Post to Facebook
         $args = array('message' => $capFB);
         $args['image'] = '@' . realpath($file);
         Yii::app()->facebook->api('/me/photos', 'post', $args);
         Helper::debugConsole("save fb ok");
         Helper::redir("/?p=" . $id, 0);
     } else {
         print_r($photo->getErrors());
     }
 }
开发者ID:aommiez,项目名称:pla2gram,代码行数:68,代码来源:SiteController.php

示例2: actionPostPhotos

 public function actionPostPhotos()
 {
     if (Yii::app()->user->hasState('images')) {
         $userImages = Yii::app()->user->getState('images');
         // Create model and save model
         foreach ($userImages as $image) {
             $photo = new Photo();
             $photo->picture = $image["filename"];
             $photo->description = $image["description"];
             if ($photo->save()) {
                 if (Yii::app()->user->hasState('addPhotosTo')) {
                     $addPhotosTo = Yii::app()->user->getState('addPhotosTo');
                     $addPhotosToType = $addPhotosTo[0];
                     $addPhotosToId = $addPhotosTo[1];
                     Yii::log('addphotototype is ' . $addPhotosToType);
                     Yii::log('addphototoid is ' . $addPhotosToId);
                     if ($addPhotosToType == 'menu') {
                         $photoMenu = new PhotosMenu();
                         $photoMenu->photo_id = $photo->id;
                         $photoMenu->menu_id = $addPhotosToId;
                         $photoMenu->save();
                     }
                 }
             } else {
                 // Log error
                 Yii::log("Could not save photo to DB:\n" . CVarDumper::dumpAsString($photo->getErrors()), CLogger::LEVEL_ERROR);
                 // This exception will rollback the transaction
                 throw new Exception('Could not save photos');
             }
         }
         $this->redirect(array('menu/view', 'id' => $_GET['bid']));
     }
 }
开发者ID:nbayteam,项目名称:restaurant,代码行数:33,代码来源:PhotoController.php


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