本文整理匯總了PHP中DAL::getDAL方法的典型用法代碼示例。如果您正苦於以下問題:PHP DAL::getDAL方法的具體用法?PHP DAL::getDAL怎麽用?PHP DAL::getDAL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DAL
的用法示例。
在下文中一共展示了DAL::getDAL方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
$dal = DAL::getDAL();
$this->numComments = $dal->getNumComments($this->title);
if ($this->redirectType == "Play") {
$this->url = "#view/{$this->title}/{$this->redirect}";
} else {
if ($this->redirect != null) {
$this->url = $this->redirect;
}
}
$this->images = $dal->getImagesForPost($this->title);
$this->urls = $dal->getUrlsForPost($this->title);
}
示例2: substr
$filename = substr(md5(time() . $i++), -6) . '.png';
$filepath = "{$path}{$filename}";
} while (file_exists($filepath));
// Move the file. If moving the file fails, abort.
if (!move_uploaded_file($_FILES['imagedata']['tmp_name'], $filepath)) {
echo $uri, 'error.png';
exit;
}
// Compress the image (destroying any alpha transparency).
$image = @imagecreatefrompng($filepath);
imagepng($image, $filepath, 9);
imagedestroy($image);
// Return the image URI.
echo $uri, $filename;
include 'routes/DAL.php';
$dal = DAL::getDAL();
$dal->writeImage($filename);
$newFileName = "./thumbs/" . $filename;
$fileName = "./grab/" . $filename;
list($width, $height) = getimagesize($fileName);
if ($width < $height) {
$newheight = 250;
$newwidth = floor($width * ($newheight / $height));
} else {
$newwidth = 250;
$newheight = floor($height * ($newwidth / $width));
}
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefrompng($fileName);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagepng($thumb, $newFileName);