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