當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Photo::upload方法代碼示例

本文整理匯總了PHP中Photo::upload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Photo::upload方法的具體用法?PHP Photo::upload怎麽用?PHP Photo::upload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Photo的用法示例。


在下文中一共展示了Photo::upload方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _upload_form

 protected function _upload_form()
 {
     $this->addScript("js/functions.js");
     $this->addScript("js/behaviour.js");
     $this->addScript("js/advajax.js");
     $this->addScript("js/ajax.js");
     $this->addScript("js/category-tree.js");
     $this->addScript("js/upload-form.js");
     $this->setTemplateVar('upload_action', $this->url('upload-form'));
     if (!empty($_POST['submit'])) {
         $cids = Utils::pg('cid');
         if (!is_array($cids)) {
             $cids = explode(',', $cids);
         }
         $photo = new Photo();
         $photo->setDBData('photo_description', Utils::p('description'));
         $photo->setDBData('photo_title', Utils::p('title'));
         $photo->upload($_FILES['file'], $cids);
     }
 }
開發者ID:BackupTheBerlios,項目名稱:phphoto-svn,代碼行數:20,代碼來源:Phphoto.php

示例2: fill_category_tree

require_once "includes/smarty.php";
require_once "includes/utils.php";
require_once "includes/photo.php";
$session = Session::singletone();
if ($session->requireLogin()) {
    exit;
}
HTML::startHTML();
HTML::head(_UPLOAD_PHOTO);
HTML::startBODY();
$smarty = new Phph_Smarty(_UPLOAD_PHOTO);
$ref = Utils::pg("ref");
if (isset($_POST['submit'])) {
    try {
        $photo = new Photo();
        $photo->upload($_FILES['file'], $_POST['title'], $_POST['description'], $_POST['cid']);
    } catch (Exception2 $e) {
        $smarty->assign('error', 1);
        $smarty->assign('error_title', $e->getMessage());
        $smarty->assign('error_description', $e->getDescription());
    }
}
$smarty->assign('l_upload', _UPLOAD);
$smarty->assign('l_file', _FILE);
$smarty->assign('l_title', _TITLE);
$smarty->assign('l_description', _DESCRIPTION);
$smarty->assign('l_category', _CATEGORY);
$smarty->assign('max_file_size', Config::get("max_file_size") * 1024);
$smarty->assign('ref', $ref);
function fill_category_tree(&$categories, $ccid, $level)
{
開發者ID:BackupTheBerlios,項目名稱:phphoto-svn,代碼行數:31,代碼來源:upload.php

示例3: Photo

<?php

/**
 * Created by PhpStorm.
 * User: Engr. Naveed
 * Date: 2/6/2015
 * Time: 6:10 PM
 */
require_once __DIR__ . "/" . "../initialize.php";
if (isset($_FILES['photoInput']) & isset($_POST['person_id'])) {
    $inputFile = 'photoInput';
    $uploadDir = "../photos";
    $targetName = $_POST['person_id'] . ".jpg";
    $photo = new Photo();
    if ($photo->upload($inputFile, $targetName, $uploadDir)) {
        $photo->resizeImage($photo->destination, $photo->destination, 210, 260);
        echo "Photo uploaded successfully.";
    } else {
        echo $photo->error;
    }
}
開發者ID:nveeed,項目名稱:ems,代碼行數:21,代碼來源:photoUploader.php


注:本文中的Photo::upload方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。