本文整理匯總了PHP中Images::newImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::newImage方法的具體用法?PHP Images::newImage怎麽用?PHP Images::newImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Images
的用法示例。
在下文中一共展示了Images::newImage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addImage
protected function addImage($file)
{
require_once './includes/dbcon.php';
require_once './includes/Images/Images.php';
$dbImages = new Images($conn);
$image_path .= isset($this->newName) ? $this->newName : $file['name'];
if (!isset($this->imgname) || is_null($this->imgname)) {
$this->imgname = $image_path;
}
if (!isset($this->imgdesc) || is_null($this->imgdesc)) {
$this->imgdesc = null;
}
$result = $dbImages->newImage($this->imgname, $image_path, $this->imgdesc, $this->category_id, $this->user_id);
if (!$result) {
$this->messages[] = 'Vandamál við að setja ' . $file['name'] . ' inn í gagnagrunn';
}
}
示例2: header
}
if (!isset($_SESSION['upload'])) {
header("Location: userpage.php");
die;
}
$dbCategories = new Categories($conn);
if (isset($_POST['reviewImage']) && !isset($validReview)) {
echo "Einhver villa kom upp.";
}
$result = true;
if (isset($validReview)) {
$dbImages = new Images($conn);
for ($i = 0; $i < count($nafn); $i++) {
$filesize[$i] = filesize("./img/temp/large/" . $_SESSION['upload'][$i]);
$imagetype[$i] = exif_imagetype("./img/temp/large/" . $_SESSION['upload'][$i]);
$result = $dbImages->newImage($nafn[$i], utf8_encode($_SESSION['upload'][$i]), $texti[$i], $flokkur[$i], $_SESSION['userID'], $visibility[$i], $filesize[$i], $imagetype[$i]);
}
if ($result) {
foreach ($_SESSION['upload'] as $key => $value) {
rename("./img/temp/thumbs/thumb_" . $value, "./img/thumbs/thumb_" . $value);
rename("./img/temp/large/" . $value, "./img/large/" . $value);
}
unset($_SESSION['upload']);
header("Location: index.php");
die;
}
}
if (isset($_POST['cancel'])) {
foreach ($_SESSION['upload'] as $key => $value) {
unlink("./img/temp/thumbs/thumb_" . $value);
unlink("./img/temp/large/" . $value);