本文整理匯總了PHP中dir::rmkdir方法的典型用法代碼示例。如果您正苦於以下問題:PHP dir::rmkdir方法的具體用法?PHP dir::rmkdir怎麽用?PHP dir::rmkdir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dir
的用法示例。
在下文中一共展示了dir::rmkdir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: makeThumb
protected function makeThumb($file, $overwrite = true)
{
$gd = new gd($file);
// Drop files which are not GD handled images
if ($gd->init_error) {
return true;
}
$thumb = substr($file, strlen($this->config['uploadDir']));
$thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
$thumb = path::normalize($thumb);
$thumbDir = dirname($thumb);
if (!is_dir($thumbDir) && !dir::rmkdir($thumbDir, $this->config['dirPerms'])) {
return false;
}
if (!$overwrite && is_file($thumb)) {
return true;
}
// Images with smaller resolutions than thumbnails
if ($gd->get_width() <= $this->config['thumbWidth'] && $gd->get_height() <= $this->config['thumbHeight']) {
$browsable = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_JPEG2000, IMAGETYPE_PNG);
// Drop only browsable types
if (in_array($gd->type, $browsable)) {
return true;
}
// Resize image
} elseif (!$gd->resize_fit($this->config['thumbWidth'], $this->config['thumbHeight'])) {
return false;
}
// Save thumbnail
return $gd->imagejpeg($thumb, $this->config['jpegQuality']);
}