本文整理汇总了PHP中discuz_upload::check_dir_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP discuz_upload::check_dir_exists方法的具体用法?PHP discuz_upload::check_dir_exists怎么用?PHP discuz_upload::check_dir_exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discuz_upload
的用法示例。
在下文中一共展示了discuz_upload::check_dir_exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_target_dir
function get_target_dir($type, $extid = '', $check_exists = true)
{
$subdir = $subdir1 = $subdir2 = '';
if ($type == 'album' || $type == 'forum' || $type == 'portal' || $type == 'category' || $type == 'profile') {
$subdir1 = date('Ym');
$subdir2 = date('d');
$subdir = $subdir1 . '/' . $subdir2 . '/';
} elseif ($type == 'group' || $type == 'common') {
$subdir = $subdir1 = substr(md5($extid), 0, 2) . '/';
}
$check_exists && discuz_upload::check_dir_exists($type, $subdir1, $subdir2);
return $subdir;
}
示例2: stringtopic
function stringtopic($value, $key = '', $force = false, $rlength = 0)
{
if ($key === '') {
$key = $value;
}
$basedir = !getglobal('setting/attachdir') ? './data/attachment' : getglobal('setting/attachdir');
$url = !getglobal('setting/attachurl') ? './data/attachment/' : getglobal('setting/attachurl');
$subdir1 = substr(md5($key), 0, 2);
$subdir2 = substr(md5($key), 2, 2);
$target = 'temp/' . $subdir1 . '/' . $subdir2 . '/';
$targetname = substr(md5($key), 8, 16) . '.png';
discuz_upload::check_dir_exists('temp', $subdir1, $subdir2);
if (!$force && file_exists($basedir . '/' . $target . $targetname)) {
return $url . $target . $targetname;
}
$value = str_replace("\n", '', $value);
$fontfile = $fontname = '';
$ttfenabled = false;
$size = 10;
$w = 130;
$rowh = 25;
$value = explode("\r", $value);
if ($rlength) {
$temp = array();
foreach ($value as $str) {
$strlen = dstrlen($str);
if ($strlen > $rlength) {
for ($i = 0; $i < $strlen; $i++) {
$sub = cutstr($str, $rlength, '');
$temp[] = $sub;
$str = substr($str, strlen($sub));
$strlen = $strlen - $rlength;
}
} else {
$temp[] = $str;
}
}
$value = $temp;
unset($temp);
}
if (function_exists('imagettftext')) {
$fontroot = DISCUZ_ROOT . './static/image/seccode/font/ch/';
$dirs = opendir($fontroot);
while ($entry = readdir($dirs)) {
if ($entry != '.' && $entry != '..' && in_array(strtolower(fileext($entry)), array('ttf', 'ttc'))) {
$fontname = $entry;
break;
}
}
if (!empty($fontname)) {
$fontfile = DISCUZ_ROOT . './static/image/seccode/font/ch/' . $fontname;
}
if ($fontfile) {
if (strtoupper(CHARSET) != 'UTF-8') {
include DISCUZ_ROOT . './source/class/class_chinese.php';
$cvt = new Chinese(CHARSET, 'utf8');
$value = $cvt->Convert(implode("\r", $value));
$value = explode("\r", $value);
}
$ttfenabled = true;
}
}
foreach ($value as $str) {
if ($ttfenabled) {
$box = imagettfbbox($size, 0, $fontfile, $str);
$height = max($box[1], $box[3]) - min($box[5], $box[7]);
$len = max($box[2], $box[4]) - min($box[0], $box[6]);
$rowh = max(array($height, $rowh));
} else {
$len = strlen($str) * 12;
}
$w = max(array($len, $w));
}
$h = $rowh * count($value) + count($value) * 2;
$im = @imagecreate($w, $h);
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 60, 60, 60);
$h = $ttfenabled ? $rowh : 4;
foreach ($value as $str) {
if ($ttfenabled) {
imagettftext($im, $size, 0, 0, $h, $text_color, $fontfile, $str);
$h += 2;
} else {
imagestring($im, $size, 0, $h, $str, $text_color);
}
$h += $rowh;
}
imagepng($im, $basedir . '/' . $target . $targetname);
imagedestroy($im);
return $url . $target . $targetname;
}
示例3: get_target_dir
/**
* 获取文件最终存储路径
*
* @param string $type
* @param int $extid
* @param boolean $check_exists
* @return string
*/
function get_target_dir($type, $extid = '', $check_exists = true)
{
$subdir1 = date('Ym');
$subdir2 = date('d');
$subdir = $subdir1 . '/' . $subdir2 . '/';
$check_exists && discuz_upload::check_dir_exists($type, $subdir1, $subdir2);
return $subdir;
}