當前位置: 首頁>>代碼示例>>PHP>>正文


PHP discuz_upload::check_dir_exists方法代碼示例

本文整理匯總了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;
 }
開發者ID:pan289091315,項目名稱:Discuz,代碼行數:13,代碼來源:class_upload.php

示例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;
}
開發者ID:samyex6,項目名稱:discuz3.2-lite,代碼行數:91,代碼來源:function_forum.php

示例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;
 }
開發者ID:pan289091315,項目名稱:Discuz,代碼行數:16,代碼來源:class_upload.php


注:本文中的discuz_upload::check_dir_exists方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。