本文整理汇总了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);
}
}
示例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)
{
示例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;
}
}