当前位置: 首页>>代码示例>>PHP>>正文


PHP hg_mkdir函数代码示例

本文整理汇总了PHP中hg_mkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP hg_mkdir函数的具体用法?PHP hg_mkdir怎么用?PHP hg_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hg_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 public function handle($video_id, $uploadedfile, $title = "")
 {
     //源文件
     $image = getimagesize($uploadedfile);
     $width = $image[0];
     $height = $image[1];
     //文件名
     $file_name = md5($video_id) . ".jpg";
     $size = $this->settings['video_img_size'];
     //目录
     $file_dir = UPLOAD_DIR . VIDEO_DIR . ceil($video_id / NUM_IMG) . "/";
     //文件路径
     $file_path = $file_dir . $file_name;
     if (!hg_mkdir($file_dir)) {
         $this->errorOutput(UPLOAD_ERR_NO_FILE);
     }
     if (!copy($uploadedfile, $file_path)) {
         return "ID为" . $video_id . "视频《" . $title . "》缩略图<span style='color:red;'>生成失败!</span><br />";
     }
     $img = new GDImage($file_path, $file_path, '');
     $info = array();
     foreach ($size as $key => $value) {
         $new_name = $value['label'] . $file_name;
         $save_file_path = $file_dir . $new_name;
         $img->init_setting($file_path, $save_file_path, '');
         $img->maxWidth = $value['width'];
         $img->maxHeight = $value['height'];
         $img->makeThumb(3, false);
         $info[$key] = UPLOAD_URL . VIDEO_DIR . ceil($video_id / NUM_IMG) . "/" . $new_name;
     }
     $sql = "update " . DB_PREFIX . "video set images='" . $file_name . "' where id=" . $video_id;
     $this->db->query($sql);
     return "ID为" . $video_id . "视频《" . $title . "》缩略图生成成功!<br />";
 }
开发者ID:h3len,项目名称:Project,代码行数:34,代码来源:update_video_state.php

示例2: startsnap

 public function startsnap()
 {
     $id = $this->input['channel_id'];
     $stream_uri = $this->input['stream_uri'];
     if (!$id || !$stream_uri) {
         $this->errorOutput('频道id或者流地址不能为空');
     }
     $time = $this->input['time'] ? $this->input['time'] : TIMENOW;
     $filename = TARGET_DIR . 'livesnap/' . $id . '/%d.png';
     hg_mkdir(TARGET_DIR . 'livesnap/' . $id);
     $cmd = 'ps -ef|grep ' . $stream_uri;
     exec($cmd, $out, $status);
     foreach ($out as $v) {
         if (strstr($v, FFMPEG_CMD)) {
             $v = preg_replace('/\\s+/is', ' ', $v);
             $pid = explode(' ', $v);
             $pid = intval($pid[1]);
             break;
         }
     }
     if ($pid) {
         $snap = array('channel_id' => $id, 'pid' => $pid);
         $this->addItem($snap);
         $this->output();
     }
     $snapinterval = intval($this->input['interval']);
     $snapinterval = $snapinterval ? $snapinterval : 1;
     $snapcmd = 'nohup ' . FFMPEG_CMD . ' -i ' . $stream_uri . ' -vcodec png -s 320x240 -r ' . $snapinterval . ' -y ' . $filename . ' > /dev/null &';
     exec($snapcmd, $out, $status);
     $snap = array('channel_id' => $id, 'snapcmd' => $snapcmd);
     $this->addItem($snap);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:livesnap.php

示例3: auto_save_create

 private function auto_save_create($vcr)
 {
     //先插入fast_vcr_tmp表
     $data = array('user_id' => $this->user['user_id'], 'main_video_id' => $vcr['main_video_id'], 'vcr_type' => $vcr['vcr_type'], 'vodinfo_id' => $vcr['vodinfo_id'], 'input_point' => $vcr['input_point'], 'output_point' => $vcr['output_point'], 'hash_id' => $vcr['hash_id']);
     $sql = ' INSERT INTO ' . DB_PREFIX . 'fast_vcr_tmp SET ';
     foreach ($data as $k => $v) {
         $sql .= $k . ' = "' . $v . '",';
     }
     $sql = rtrim($sql, ',');
     $this->db->query($sql);
     //保存图片data数据
     $start_filename = $vcr['hash_id'] . '_start.img';
     $end_filename = $vcr['hash_id'] . '_end.img';
     if (!hg_mkdir(FAST_EDIT_IMGDATA_PATH) || !is_writeable(FAST_EDIT_IMGDATA_PATH)) {
         $this->errorOutput(NOWRITE);
     }
     if ($this->input['start_imgdata']) {
         @file_put_contents(FAST_EDIT_IMGDATA_PATH . $start_filename, $this->input['start_imgdata']);
     }
     if ($this->input['end_imgdata']) {
         @file_put_contents(FAST_EDIT_IMGDATA_PATH . $start_filename, $this->input['end_imgdata']);
     }
     $this->addItem('success');
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:vod_fast_edit_video_opration.php

示例4: __destruct

 }
 public function __destruct()
 {
     parent::__destruct();
 }
 public function convert()
 {
     global $gGlobalConfig;
     include_once ROOT_PATH . 'lib/class/curl.class.php';
     if ($gGlobalConfig['App_officeconvert']) {
         $curl = new curl($gGlobalConfig['App_officeconvert']['host'], $gGlobalConfig['App_officeconvert']['dir']);
     }
     $curl->setSubmitType('post');
     $curl->setReturnFormat('json');
     $curl->initPostData();
     $curl->addRequestData('custom_appid', CUSTOM_APPID);
     $curl->addRequestData('custom_appkey', CUSTOM_APPKEY);
     $curl->addFile($_FILES);
     $result = $curl->request('convert.php');
     //var_dump($result);exit;
     $path = 'cache/word/zip_' . uniqid() . '/';
     $zipDir = ROOT_PATH . $path;
     $return = array();
     if (hg_mkdir($zipDir) && is_writeable($zipDir)) {
         $zipFile = $zipDir . 'word.zip';
         file_put_contents($zipFile, $result);
         $unzipDir = $zipDir . 'unzip/';
         if (hg_mkdir($unzipDir) && is_writeable($unzipDir)) {
             $unzipCmd = ' unzip ' . $zipFile . ' -d ' . realpath($unzipDir);
             exec($unzipCmd);
             $rmZip = ' rm -f ' . $zipFile;
             exec($rmZip);
开发者ID:h3len,项目名称:Project,代码行数:32,代码来源:convert.php

示例5: file_copy

/**
 * 原目录,复制到的目录
 * */
function file_copy($from, $to, $filenamearr = array())
{
    $status = true;
    $dir = @opendir($from);
    if (!is_dir($to)) {
        @hg_mkdir($to);
    }
    while (false !== ($file = readdir($dir))) {
        if ($filenamearr) {
            if (!in_array($file, $filenamearr)) {
                continue;
            }
        }
        if ($file != '.' && $file != '..') {
            if (is_dir($from . '/' . $file)) {
                file_copy($from . '/' . $file, $to . '/' . $file, $filenamearr);
            } else {
                if (!@copy($from . '/' . $file, $to . '/' . $file)) {
                    $status = false;
                    break;
                }
            }
        }
    }
    closedir($dir);
    return $status;
}
开发者ID:h3len,项目名称:Project,代码行数:30,代码来源:functions.php

示例6: video

 public function video()
 {
     $id = intval($this->input['id']);
     $f = $this->input['f'];
     $api = stripslashes(urldecode($_REQUEST['api']));
     $api = json_decode($api, true);
     if (!$id) {
         $this->ReportError('请指定要下载的视频!');
     }
     if (!$api || !$f) {
         $this->ReportError('未指定下载接口!');
     }
     $url = 'http://' . $api['host'] . '/' . $api['dir'] . $f . '?access_token=' . $this->user['token'] . '&id=' . $id;
     $filename = time() . mt_rand(1, 99999);
     hg_mkdir(ROOT_PATH . 'cache/tmp/');
     $tempfile = ROOT_PATH . 'cache/tmp/' . $filename . '.mp4';
     $count = 0;
     while (is_file($tempfile) && $count < 50) {
         $filename = time() . mt_rand(1, 99999);
         $tempfile = ROOT_PATH . 'cache/tmp/' . $filename . '.mp4';
     }
     $cmd = 'curl "' . $url . '" > ' . $tempfile;
     //$filesize = strlen($content);
     exec($cmd);
     $filesize = filesize($tempfile);
     if ($this->input['title']) {
         $filename = iconv('UTF-8', 'GBK', $this->input['title']);
     }
     header("Content-Type: application/force-download");
     header("Content-Transfer-Encoding: binary\n");
     header('Content-Length: ' . $filesize);
     header("Content-Disposition: attachment; filename=" . $filename . '.mp4');
     readfile($tempfile);
     @unlink($tempfile);
 }
开发者ID:h3len,项目名称:Project,代码行数:35,代码来源:download.php

示例7: create

 public function create()
 {
     if (!$_FILES['water_pic']) {
         $this->errorOutput('没有图片文件');
     }
     if (!hg_mkdir(TARGET_DIR . 'water/') || !is_writeable(TARGET_DIR . 'water/')) {
         $this->errorOutput(NOWRITE);
     }
     $original = $_FILES['water_pic']['name'];
     $filetype = strtolower(strrchr($original, '.'));
     //随机产生一个文件名
     $filename = TIMENOW . hg_rand_num(6) . $filetype;
     if (!@move_uploaded_file($_FILES['water_pic']['tmp_name'], TARGET_DIR . 'water/' . $filename)) {
         $this->errorOutput(FAILMOVE);
     }
     //图片文件传上去之后,记录数据库
     $data = array('name' => $this->input['name'], 'hostwork' => defined('TARGET_VIDEO_DOMAIN') && TARGET_VIDEO_DOMAIN ? ltrim(TARGET_VIDEO_DOMAIN, 'http://') : $this->settings['videouploads']['host'], 'base_path' => TARGET_DIR . 'water/', 'img_path' => $filename, 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'org_id' => $this->user['org_id']);
     $vid = $this->mode->create($data);
     if ($vid) {
         $data['id'] = $vid;
         $this->addLogs('创建水印', $data, '', '创建水印' . $vid);
         $this->addItem('success');
         $this->output();
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:water_config_update.php

示例8: show

 public function show()
 {
     if (!$this->input['id']) {
         $this->errorOutput(NOID);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "vodinfo WHERE id = '" . intval($this->input['id']) . "'";
     $arr = $this->db->query_first($sql);
     if (!$arr) {
         $this->errorOutput('指定视频不存在');
     }
     $filename = iconv('UTF-8', 'GBK', $arr['title']);
     hg_mkdir(UPLOAD_DIR . 'tmp/download/');
     $tempfile = UPLOAD_DIR . 'tmp/download/' . time() . mt_rand(1, 99999) . '.mp4';
     $count = 0;
     while (is_file($tempfile) && $count < 50) {
         $tempfile = UPLOAD_DIR . 'tmp/download/' . time() . mt_rand(1, 99999) . '.mp4';
     }
     $cmd = 'curl "http://' . $this->settings['App_mediaserver']['host'] . '/' . $this->settings['App_mediaserver']['dir'] . 'admin/download.php?auth=' . $this->settings['App_mediaserver']['token'] . '&id=' . $arr['id'] . '" > ' . $tempfile;
     //$filesize = strlen($content);
     exec($cmd);
     $filesize = filesize($tempfile);
     header("Content-Type: application/force-download");
     header("Content-Transfer-Encoding: binary\n");
     header('Content-Length: ' . $filesize);
     header("Content-Disposition: attachment; filename=" . $filename . '.mp4');
     readfile($tempfile);
     $sql = 'UPDATE ' . DB_PREFIX . 'vodinfo SET downcount=downcount+1 WHERE id = ' . $arr['id'];
     $this->db->query($sql);
     @unlink($tempfile);
 }
开发者ID:h3len,项目名称:Project,代码行数:30,代码来源:vod_down.php

示例9: recommond_show

 public function recommond_show()
 {
     if (!$this->input['column_id']) {
         $this->errorOutput('未传入栏目ID');
     }
     $columnd_id = $this->input['column_id'];
     $offset = $this->input['offset'] ? $this->input['offset'] : 0;
     $count = $this->input['count'] ? intval($this->input['count']) : 20;
     $file_name_prex = 'recommond-' . $columnd_id . '-';
     $dir = RECOMMOND_CACHE;
     $ret = array();
     if (hg_mkdir($dir)) {
         $file_name = $file_name_prex . $count . '-' . $offset . '.tmp';
         if (file_exists($dir . $file_name)) {
             $ret = json_decode(file_get_contents($dir . $file_name), true);
         } else {
             $condition = $this->get_condition();
             $data_limit = ' LIMIT ' . $offset . ' , ' . $count;
             $ret = $this->obj->show($condition . " ORDER BY orderid DESC " . $data_limit);
             file_put_contents($dir . $file_name, json_encode($ret));
         }
     }
     $this->addItem($ret);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:25,代码来源:recommond.php

示例10: show

 /**
  * 获取图片列表显示
  */
 function show()
 {
     $offset = $this->input['offset'] ? intval(urldecode($this->input['offset'])) : 0;
     $count = $this->input['count'] ? intval(urldecode($this->input['count'])) : 10;
     $limit = " limit {$offset}, {$count}";
     $condition = $this->get_condition();
     $sql = 'SELECT p.*,t.title as tuji_title,t.comment,t.path as tuji_path,s.sort_name FROM ' . DB_PREFIX . 'pics p LEFT JOIN ' . DB_PREFIX . 'tuji t ON p.tuji_id = t.id LEFT JOIN ' . DB_PREFIX . 'tuji_sort s ON s.id = t.tuji_sort_id WHERE 1 ' . $condition . ' ORDER BY create_time DESC ' . $limit;
     $this->setXmlNode('pics', 'pic');
     //print_r($this->db->fetch_all($sql));
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d h:i:s', $r['create_time']);
         $r['update_time'] = date('Y-m-d h:i:s', $r['update_time']);
         $r['pic_url'] = UPLOAD_ABSOLUTE_URL . hg_num2dir($r['tuji_id']) . $r['new_name'];
         $r['description'] = $r['description'] ? $r['description'] : (!DESCRIPTION_TYPE ? $r['comment'] : '');
         unset($r['comment']);
         if ($this->input['width'] || $this->input['height']) {
             $subdir = hg_num2dir($r['tuji_id']) . intval($this->input['width']) . intval($this->input['height']) . '/';
             $thumb_dir = UPLOAD_THUMB_DIR . $subdir;
             if (!is_dir($thumb_dir)) {
                 @hg_mkdir($thumb_dir);
             }
             $thumb_file = $this->settings['thumb']['prefix'] . $r['new_name'];
             $this->gd->init_setting($r['pic_url'], $thumb_dir . $thumb_file);
             if ($location = $this->gd->makeThumb(1)) {
                 $r['thumb_url'] = UPLOAD_THUMB_URL . $subdir . $thumb_file;
             }
             //$r['thumb_url'] = $thumb_dir;
         }
         $this->addItem($r);
     }
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:36,代码来源:pics.php

示例11: log2file

function log2file($user, $level, $message, $input, $output = array())
{
    if (!LOG_LEVEL) {
        return;
    }
    if (LOG_FOR_USER != 'ALL' && $user['user_name'] != LOG_FOR_USER) {
        return;
    }
    $level = strtoupper($level);
    $log_level = array('ERROR' => 1, 'DEBUG' => 2, 'ALL' => 3);
    if ($log_level[$level] > LOG_LEVEL) {
        return;
    }
    $log_path = CUR_CONF_PATH . 'data/log/' . date('Y') . '/' . date('m') . '/';
    if (!is_dir($log_path)) {
        hg_mkdir($log_path);
    }
    $input = json_encode($input);
    $output = json_encode($output);
    $time = date('Y-m-d H:i');
    $user = @json_encode($user);
    $log_message_tpl = <<<LC
Level   : {$level}
Message : {$message}
Input   : {$input}
Ouput   : {$output}
Date\t: {$time}
User\t: {$user}


LC;
    hg_file_write($log_path . 'log-' . date('Y-m-d') . '.php', $log_message_tpl, 'a+');
}
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:functions.php

示例12: hg_debug_tofile

function hg_debug_tofile($str = '', $is_arr = 0, $dir = '', $filename = 'log.txt', $op_type = 'a+', $tofile = true)
{
    if ($is_arr) {
        $str = var_export($str, true);
    }
    if ($op_type == "a" || $op_type == "a+") {
        if ($tofile) {
            $entersplit = "\r\n";
        } else {
            $entersplit = "<br />";
        }
    }
    $tmp_info = debug_backtrace();
    $str .= $entersplit;
    $debug_tree = "";
    $max = count($tmp_info);
    $i = 1;
    foreach ($tmp_info as $debug_info) {
        $space = str_repeat('&nbsp;&nbsp;', $max - $i);
        $debug_tree = $entersplit . $space . $debug_info['file'] . " on line " . $debug_info['line'] . ":" . $debug_tree;
        $i++;
    }
    $str = $entersplit . '[' . date('Y-m-d H:i:s') . ']' . $debug_tree . $str;
    if ($tofile) {
        $filename = $filename ? $filename : "log.txt";
        $filenamedir = explode('/', $filename);
        unset($filenamedir[count($filenamedir) - 1]);
        hg_mkdir(LOG_DIR . $dir . implode('/', $filenamedir));
        hg_file_write(LOG_DIR . $dir . $filename, $str, $op_type);
    } else {
        echo $str;
    }
}
开发者ID:h3len,项目名称:Project,代码行数:33,代码来源:debug.php

示例13: run

 public function run()
 {
     //判断有没有登陆
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_LOGIN);
     }
     //获取嘉宾信息
     $_memberInfo = $this->member_mode->detail('', " AND member_id = '" . $this->user['user_id'] . "' ");
     if (!$_memberInfo) {
         $this->errorOutput(YOU_HAVE_NOT_ACTIVATED);
     }
     //根据激活码id查询出激活码
     $code = $this->activate->detail($_memberInfo['activate_code_id']);
     if (!$code) {
         $code = array('guest_type_text' => $this->settings['guest_type'][1]);
     }
     //获取该嘉宾在用户中心的头像
     $avatar = array();
     if ($member_info = $this->getMemberInfoFromMemberCenter($this->user['user_id'])) {
         if ($member_info[0]) {
             $member_info = $member_info[0];
             if ($member_info['avatar'] && is_array($member_info['avatar'])) {
                 $avatar = $member_info['avatar'];
             }
         }
     }
     //更新库里面的头像
     $_avatar = $avatar && is_array($avatar) ? addslashes(serialize($avatar)) : '';
     if ($this->member_mode->update($_memberInfo['id'], array('avatar' => $_avatar))) {
         //构建名片数据
         $_vcard_data = array('id' => $_memberInfo['id'], 'name' => $_memberInfo['name'], 'company' => $_memberInfo['company'], 'job' => $_memberInfo['job'], 'telephone' => $_memberInfo['telephone'], 'email' => $_memberInfo['email'], 'avatar' => $avatar, 'guest_type_text' => $code['guest_type_text']);
         //引入二维码类
         if (!class_exists('QRcode')) {
             include_once CUR_CONF_PATH . 'lib/qrcode.class.php';
         }
         $_pic_name = $_memberInfo['vcard_pic_name'];
         $_isupdate = 0;
         //如果库里面二维码图片的名称都没有就产生图片名
         if (!$_pic_name) {
             $_pic_name = md5(TIMENOW . hg_rand_num(6)) . '.png';
             //随机产生图片文件名
             $_isupdate = 1;
         }
         if (!hg_mkdir(VCARD_DIR) || !is_writeable(VCARD_DIR)) {
             $this->errorOutput(NO_WRITE);
         }
         QRcode::png(json_encode($_vcard_data), VCARD_DIR . $_pic_name);
         //更新库里面的图片名称
         if ($_isupdate) {
             $this->member_mode->update($_memberInfo['id'], array('vcard_pic_name' => $_pic_name));
             $_memberInfo['vcard_pic_name'] = $_pic_name;
         }
     }
     $this->addItem(array('return' => 1));
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:56,代码来源:update_avatar.php

示例14: recache

 function recache($cache_name, $cache_dir = CACHE_DIR)
 {
     if (empty($cache_name)) {
         return false;
     }
     $material_type = $this->get_material_type();
     hg_mkdir($cache_dir);
     $cache_file = $cache_dir . $cache_name;
     hg_file_write($cache_file, serialize($material_type));
     return $material_type;
 }
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:cache.class.php

示例15: writeErrorLog

function writeErrorLog($info = '')
{
    $path_dir = CACHE_DIR . 'error/';
    if (!hg_mkdir($path_dir) || !is_writeable($path_dir)) {
        return false;
    }
    $msg = "\n======================" . date('Y-m-d H:i:s', TIMENOW) . "============================\n";
    $msg .= $info;
    $msg .= "\n=====================================================================\n";
    file_put_contents($path_dir . 'error.log', $msg, FILE_APPEND);
}
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:functions.php


注:本文中的hg_mkdir函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。