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


PHP photo类代码示例

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


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

示例1: removeimage

 function removeimage($id)
 {
     $sql = "delete from `rentorhire_images` where photo_id='" . $id . "'";
     $result = $this->mysql->query($sql);
     $ph = new photo();
     $ph->deletePhoto($id);
 }
开发者ID:sknlim,项目名称:classified-2,代码行数:7,代码来源:rentorhire.class.php

示例2: slideshow

 public function slideshow()
 {
     expHistory::set('viewable', $this->params);
     $where = $this->aggregateWhereClause();
     $order = 'rank';
     $s = new photo();
     $slides = $s->find('all', $where, $order);
     assign_to_template(array('slides' => $slides));
 }
开发者ID:notzen,项目名称:exponent-cms,代码行数:9,代码来源:photosController.php

示例3: _create_random_item

 private static function _create_random_item($root = null, $rand = null)
 {
     $root = $root ? $root : ORM::factory("item", 1);
     $rand = $rand ? $rand : rand();
     $item = photo::create($root, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
     return $item;
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:7,代码来源:Item_Model_Test.php

示例4: create

 /**
  * 注册内部管理账户
  *
  * @access public
  * @param string phoneNum 手机号
  * @param string password 登陆密码md5
  * @return array
  */
 public function create()
 {
     #参数检查
     $this->params = $this->require_params(array('phoneNum', 'password'));
     $this->params['nickname'] = F::request('nickname', '');
     $this->params['project'] = F::request('project', '');
     $this->params['project'] = str_replace(',', ',', $this->params['project']);
     if (!FValidator::phone($this->params['phoneNum'])) {
         throw new Exception('手机号格式非法', 100);
     }
     #检查手机是否已经注册
     $userId = $this->userModel->getUserIdByUsername($this->params['phoneNum']);
     if (!$userId) {
         #生成一个新的账户
         $userId = $this->userModel->create($this->params['phoneNum'], $this->params['password'], self::ADMIN_ACCOUNT);
     } else {
         #更新账户密码信息
         $updateResult = $this->userModel->updatePassword($userId, $this->params['password']);
     }
     #保存图片信息
     $filePath = 'avatar/' . $userId . '_' . md5_file($_FILES['photo']['tmp_name']) . '.' . end(explode('.', $_FILES['photo']['name']));
     $this->photoTool->copyImageWithSize($_FILES['photo']['tmp_name'], self::IMG_PATH_BASE . $filePath, 60, 60);
     $this->params['photo'] = $filePath;
     #更新用户昵称
     $this->userModel->updateUserProfile($userId, $this->params['nickname'], $filePath);
     #授权相关项目授权
     $this->userModel->getProjectAuth($userId, explode(',', $this->params['project']));
     #跳转回user_add页面
     header('location:http://' . $_SERVER['HTTP_HOST'] . '/' . self::CRM_ADMIN_BASE . 'user_add.php');
 }
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:38,代码来源:user_controller.php

示例5: add_photo

 public function add_photo($id)
 {
     $album = ORM::factory("item", $id);
     access::required("view", $album);
     access::required("add", $album);
     access::verify_csrf();
     $file_validation = new Validation($_FILES);
     $file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]");
     if ($file_validation->validate()) {
         // SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
         if (!batch::in_progress()) {
             batch::start();
         }
         $temp_filename = upload::save("Filedata");
         try {
             $name = substr(basename($temp_filename), 10);
             // Skip unique identifier Kohana adds
             $title = item::convert_filename_to_title($name);
             $path_info = pathinfo($temp_filename);
             if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) {
                 $movie = movie::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a movie"), html::anchor("movies/{$movie->id}", t("view movie")));
             } else {
                 $photo = photo::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a photo"), html::anchor("photos/{$photo->id}", t("view photo")));
             }
         } catch (Exception $e) {
             unlink($temp_filename);
             throw $e;
         }
         unlink($temp_filename);
     }
     print "File Received";
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:34,代码来源:simple_uploader.php

示例6: form_edit

 public function form_edit($photo_id)
 {
     $photo = ORM::factory("item", $photo_id);
     access::required("view", $photo);
     access::required("edit", $photo);
     print photo::get_edit_form($photo);
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:7,代码来源:photos.php

示例7: exif_extract_test

 public function exif_extract_test()
 {
     $rand = rand();
     $root = ORM::factory("item", 1);
     $photo = photo::create($root, MODPATH . "exif/tests/data/image.jpg", "{$rand}.jpg", $rand, $rand);
     $expected = array(array("caption" => "Camera Maker", "value" => "Pentax Corporation"), array("caption" => "Camera Model", "value" => "PENTAX K10D"), array("caption" => "Aperture", "value" => "f/2.8"), array("caption" => "Color Space", "value" => "Uncalibrated"), array("caption" => "Exposure Value", "value" => "4294.67 EV"), array("caption" => "Exposure Program", "value" => "Program"), array("caption" => "Exposure Time", "value" => "1/60 sec"), array("caption" => "Flash", "value" => "No Flash"), array("caption" => "Focal Length", "value" => "50 mm"), array("caption" => "ISO", "value" => "6553700"), array("caption" => "Metering Mode", "value" => "Multi-Segment"), array("caption" => "Date/Time", "value" => "2008:03:17 17:41:25"), array("caption" => "Copyright", "value" => "(C) 2008 -  T. Almdal"), array("caption" => "Orientation", "value" => "1: Normal (0 deg)"), array("caption" => "Resolution Unit", "value" => "Inch"), array("caption" => "X Resolution", "value" => "240 dots per ResolutionUnit"), array("caption" => "Y Resolution", "value" => "240 dots per ResolutionUnit"), array("caption" => "Brightness Value", "value" => "0"), array("caption" => "Scene Type", "value" => "0"), array("caption" => "Subject Distance", "value" => "0"));
     $this->assert_equal($expected, exif::get($photo));
 }
开发者ID:hiwilson,项目名称:gallery3,代码行数:8,代码来源:Exif_Test.php

示例8: saveProfile

 function saveProfile($verify)
 {
     $sim = new simulator();
     $handle = fopen("php://stdin", "r");
     $pic = new photo();
     $clr = new color();
     echo "Enter Header Picture";
     $this->temp = $pic->returnPhoto($verify);
     $size = count($this->temp);
     for ($x = 0; $x <= $size - 1; $x++) {
         echo $x . " " . $this->temp[$x] . "\n";
     }
     echo "Press Number to add photo";
     $pho = fgets($handle);
     $photo = "Header Picture: " . $this->temp[1];
     echo "Enter Profile Picture";
     for ($x = 0; $x <= $size - 1; $x++) {
         echo $x . " " . $this->temp[$x] . "\n";
     }
     $ppho = fgets($handle);
     $pPhoto = "Profile Picture:" . $this->temp[1];
     echo "Enter Full Name";
     $full_name = fgets($handle);
     echo "Enter Bio";
     $bio = fgets($handle);
     echo "Enter Location";
     $location = fgets($handle);
     echo "Enter Website";
     $website = fgets($handle);
     echo "Enter DOB ";
     $dob = fgets($handle);
     echo "Enter Theme Color";
     $clrs = $clr->returnColors();
     for ($x = 0; $x <= $size - 1; $x++) {
         echo $x . " " . $clrs[$x] . "\n";
     }
     $t = fgets($handle);
     $theme_color = $clrs[1];
     $myfile = fopen("{$verify}" . "profile", "w") or die("Unable to open file!");
     fwrite($myfile, $photo . "\n" . $pPhoto . "\n" . $full_name . $bio . $location . $website . $dob . $theme_color);
     echo "Profile Made";
     $sim->followUp($verify);
 }
开发者ID:shahmeerarshad,项目名称:Boot_Camp,代码行数:43,代码来源:profile.php

示例9: get_file_metadata_with_valid_extension_but_illegal_file_contents_test

 public function get_file_metadata_with_valid_extension_but_illegal_file_contents_test()
 {
     copy(MODPATH . "gallery/tests/Photo_Helper_Test.php", TMPPATH . "test_php_with_jpg_extension.jpg");
     try {
         $metadata = photo::get_file_metadata(TMPPATH . "test_php_with_jpg_extension.jpg");
         $this->assert_true(false, "Shouldn't get here");
     } catch (Exception $e) {
         // pass
     }
     unlink(TMPPATH . "test_php_with_jpg_extension.jpg");
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:11,代码来源:Photo_Helper_Test.php

示例10: add_from_server

 static function add_from_server($task)
 {
     $context = unserialize($task->context);
     try {
         $paths = array_keys(unserialize(module::get_var("server_add", "authorized_paths")));
         $path = $paths[$context["next_path"]];
         if (!empty($context["files"][$path])) {
             $file = $context["files"][$path][$context["position"]];
             $parent = ORM::factory("item", $file["parent_id"]);
             access::required("server_add", $parent);
             access::required("add", $parent);
             if (!$parent->is_album()) {
                 throw new Exception("@todo BAD_ALBUM");
             }
             $name = $file["name"];
             if ($file["type"] == "album") {
                 $album = ORM::factory("item")->where("name", $name)->where("parent_id", $parent->id)->find();
                 if (!$album->loaded) {
                     $album = album::create($parent, $name, $name, null, user::active()->id);
                 }
                 // Now that we have a new album. Go through the remaining files to import and change the
                 // parent_id of any file that has the same relative path as this album's path.
                 $album_path = "{$file['path']}/{$name}";
                 for ($idx = $context["position"] + 1; $idx < count($context["files"][$path]); $idx++) {
                     if (strpos($context["files"][$path][$idx]["path"], $album_path) === 0) {
                         $context["files"][$path][$idx]["parent_id"] = $album->id;
                     }
                 }
             } else {
                 $extension = strtolower(substr(strrchr($name, '.'), 1));
                 $source_path = "{$path}{$file['path']}/{$name}";
                 if (in_array($extension, array("flv", "mp4"))) {
                     $movie = movie::create($parent, $source_path, $name, $name, null, user::active()->id);
                 } else {
                     $photo = photo::create($parent, $source_path, $name, $name, null, user::active()->id);
                 }
             }
             $context["counter"]++;
             if (++$context["position"] >= count($context["files"][$path])) {
                 $context["next_path"]++;
                 $context["position"] = 0;
             }
         } else {
             $context["next_path"]++;
         }
     } catch (Exception $e) {
         $context["errors"][$path] = $e->getMessage();
     }
     $task->context = serialize($context);
     $task->state = "success";
     $task->percent_complete = $context["counter"] / (double) $context["total"] * 100;
     $task->done = $context["counter"] == (double) $context["total"];
 }
开发者ID:xafr,项目名称:gallery3,代码行数:53,代码来源:server_add_task.php

示例11: tweetInput

 function tweetInput($verify)
 {
     $pic = new photo();
     $twt = new tweet();
     $dbh = new dbHandler();
     $handle = fopen("php://stdin", "r");
     echo "Write your Tweet\n ";
     $tweet = fgets($handle);
     $text = " Tweet: " . $tweet;
     echo "Write Location";
     $loc = fgets($handle);
     $location = "Location: " . $loc;
     echo "Enter Photo\n";
     $this->pic_array = $pic->returnPhoto($verify);
     $size = count($this->pic_array);
     for ($x = 0; $x <= $size - 1; $x++) {
         echo $x . " " . $this->pic_array[$x] . "\n";
     }
     $pho = fgets($handle);
     $photo = "Picture: " . $this->pic_array[1];
     $twt->post_tweet($verify, $text, $location, $photo);
 }
开发者ID:shahmeerarshad,项目名称:Boot_Camp,代码行数:22,代码来源:simulator.php

示例12: setup

 public function setup()
 {
     $this->_server = $_SERVER;
     $root = ORM::factory("item", 1);
     $this->_album = album::create($root, rand(), "test album");
     access::deny(identity::everybody(), "view_full", $this->_album);
     access::deny(identity::registered_users(), "view_full", $this->_album);
     $rand = rand();
     $this->_item = photo::create($this->_album, MODPATH . "gallery/tests/test.jpg", "{$rand}.jpg", $rand, $rand);
     $this->_proxy = ORM::factory("digibug_proxy");
     $this->_proxy->uuid = md5(rand());
     $this->_proxy->item_id = $this->_item->id;
     $this->_proxy->save();
 }
开发者ID:viosca,项目名称:gallery3,代码行数:14,代码来源:Digibug_Controller_Test.php

示例13: item_before_create

 static function item_before_create($item)
 {
     $max_size = module::get_var("max_size", "max_size", 600);
     if ($item->is_photo()) {
         list($width, $height, $mime_type) = photo::get_file_metadata($item->data_file);
         if ($width > $max_size || $height > $max_size) {
             $tempnam = tempnam(TMPPATH, "size");
             $tmpfile = $tempnam . "." . pathinfo($item->data_file, PATHINFO_EXTENSION);
             gallery_graphics::resize($item->data_file, $tmpfile, array("width" => $max_size, "height" => $max_size, "master" => Image::AUTO));
             rename($tmpfile, $item->data_file);
             unlink($tempnam);
         }
     }
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:14,代码来源:max_size_event.php

示例14: add_photo

 public function add_photo($id)
 {
     $album = ORM::factory("item", $id);
     access::required("view", $album);
     access::required("add", $album);
     access::verify_csrf();
     $file_validation = new Validation($_FILES);
     $file_validation->add_rules("Filedata", "upload::valid", "upload::required", "upload::type[gif,jpg,jpeg,png,flv,mp4]");
     if ($file_validation->validate()) {
         // SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
         if (!batch::in_progress()) {
             batch::start();
         }
         $temp_filename = upload::save("Filedata");
         try {
             $name = substr(basename($temp_filename), 10);
             // Skip unique identifier Kohana adds
             $title = item::convert_filename_to_title($name);
             $path_info = @pathinfo($temp_filename);
             if (array_key_exists("extension", $path_info) && in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) {
                 $item = movie::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a movie"), html::anchor("movies/{$item->id}", t("view movie")));
             } else {
                 $item = photo::create($album, $temp_filename, $name, $title);
                 log::success("content", t("Added a photo"), html::anchor("photos/{$item->id}", t("view photo")));
             }
             // We currently have no way of showing errors if validation fails, so only call our event
             // handlers if validation passes.
             $form = $this->_get_add_form($album);
             if ($form->validate()) {
                 module::event("add_photos_form_completed", $item, $form);
             }
         } catch (Exception $e) {
             Kohana_Log::add("alert", $e->__toString());
             if (file_exists($temp_filename)) {
                 unlink($temp_filename);
             }
             header("HTTP/1.1 500 Internal Server Error");
             print "ERROR: " . $e->getMessage();
             return;
         }
         unlink($temp_filename);
         print "FILEID: {$item->id}";
     } else {
         header("HTTP/1.1 400 Bad Request");
         print "ERROR: " . t("Invalid Upload");
     }
 }
开发者ID:viosca,项目名称:gallery3,代码行数:48,代码来源:simple_uploader.php

示例15: change_photo_no_csrf_fails_test

 public function change_photo_no_csrf_fails_test()
 {
     $controller = new Photos_Controller();
     $root = ORM::factory("item", 1);
     $this->_photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test", "test", "test");
     $_POST["name"] = "new name";
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     access::allow(group::everybody(), "edit", $root);
     try {
         $controller->_update($this->_photo);
         $this->assert_true(false, "This should fail");
     } catch (Exception $e) {
         // pass
     }
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:16,代码来源:Photos_Controller_Test.php


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