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


PHP material::localMaterial方法代码示例

本文整理汇总了PHP中material::localMaterial方法的典型用法代码示例。如果您正苦于以下问题:PHP material::localMaterial方法的具体用法?PHP material::localMaterial怎么用?PHP material::localMaterial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在material的用法示例。


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

示例1: insert_lbs


//.........这里部分代码省略.........
                 }
             }
             $data['tel'] = serialize($tel_arr);
         } else {
             if (stripos($arr[10], ':') !== false) {
                 $tmp = explode(':', $arr[10]);
             } else {
                 if (stripos($arr[10], ':') !== false) {
                     $tmp = explode(':', $arr[10]);
                 }
             }
             if (!empty($tmp)) {
                 $telname = $tmp[0] ? $tmp[0] : '联系电话' . ($key + 1);
                 $tel_arr[] = array('telname' => $telname, 'tel' => $tmp[1]);
             }
             $data['tel'] = serialize($tel_arr);
         }
     }
     //处理经营时间
     if ($arr[11]) {
         if (stripos($arr[11], '-') !== false) {
             $jy_time = explode('-', $arr[11]);
             $ymd = date('Y-m-d', TIMENOW);
             $stime = strtotime($ymd . ' ' . $jy_time[0]);
             $etime = strtotime($ymd . ' ' . $jy_time[1]);
             $data['stime'] = $stime;
             $data['etime'] = $etime;
         }
     }
     //入库
     if (empty($data)) {
         continue;
     }
     //如果百度坐标存在gps不存在的话,就转换为gps坐标也存起来
     if ($data['baidu_longitude'] && $data['baidu_latitude']) {
         $gps = $this->lbs->FromBaiduToGpsXY($data['baidu_longitude'], $data['baidu_latitude']);
         $data['GPS_longitude'] = $gps['GPS_x'];
         $data['GPS_latitude'] = $gps['GPS_y'];
     }
     //如果GPS坐标存在并且百度坐标不存在的话,就转换为百度坐标也存起来
     if (!$data['baidu_longitude'] && !$data['baidu_latitude'] && $data['GPS_longitude'] && $data['GPS_latitude']) {
         $baidu = array();
         //防止网络崩溃,暂时注释
         $baidu = $this->lbs->FromGpsToBaiduXY($data['GPS_longitude'], $data['GPS_latitude']);
         if (!empty($baidu)) {
             $data['baidu_longitude'] = $baidu['x'];
             $data['baidu_latitude'] = $baidu['y'];
         }
     }
     $data['create_time'] = TIMENOW;
     $data['org_id'] = $this->user['org_id'];
     $data['user_id'] = $this->user['user_id'];
     $data['user_name'] = $this->user['user_name'];
     $data['ip'] = $this->user['ip'];
     $lbs = $this->lbs->add_lbs($data);
     $id = $lbs['id'];
     if (!$id) {
         continue;
     }
     if ($arr[12]) {
         //对索引图的处理
         include_once ROOT_PATH . 'lib/class/material.class.php';
         $material_pic = new material();
         $img_info = array();
         $img_info = $material_pic->localMaterial($arr[12]);
         //图片本地化失败,重复请求3次
         /*if(empty($img_info))
         		{
         			for ($i=0;$i<3;$i++)
         			{
         				$img_info = $material_pic->localMaterial($arr[12]);
         				if(!empty($img_info))
         				{
         					break;
         				}
         			}
         		}*/
         if (!empty($img_info)) {
             $img_info = $img_info[0];
             $img_data = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename']);
             $img_data['cid'] = $id;
             //lbs的id,直接置零
             $img_data['original_id'] = $img_info['id'];
             $img_data['type'] = $img_info['type'];
             $img_data['mark'] = 'img';
             $img_data['imgwidth'] = $img_info['imgwidth'];
             $img_data['imgheight'] = $img_info['imgheight'];
             $img_data['flag'] = 1;
             $vid = $this->lbs->insert_img($img_data);
         }
         if ($vid) {
             $sql = 'UPDATE ' . DB_PREFIX . 'lbs set indexpic = ' . $vid . ' WHERE id = ' . $id;
             $this->db->query($sql);
         }
     }
     //简介描述
     if ($arr[13]) {
         $this->lbs->add_content($arr[13], $id);
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:101,代码来源:excel.class.php

示例2: storage_data

 private function storage_data($video, $vod_config)
 {
     if ($video['column_id']) {
         $publish_column = new publishconfig();
         $column_id = $video['column_id'];
         $column_id = $publish_column->get_columnname_by_ids('id,name', $column_id);
         $column_id = serialize($column_id);
     }
     $channel_id = $video['channel_id'];
     if ($video['create_time'] != -1) {
         $create_time = strtotime($video['create_time']);
     }
     $pathinfo = pathinfo($video['filepath']);
     //如果不存在分类就默认其分类与类型相同
     $vod_leixing = $video['vod_leixing'] ? $video['vod_leixing'] : 1;
     if (!$video['vod_sort_id'] || intval($video['vod_sort_id']) == -1) {
         $video['vod_sort_id'] = $vod_leixing;
     }
     /************创建视频的权限控制**********/
     if ($this->user['group_type'] > MAX_ADMIN_TYPE) {
         $prms['_action'] = 'create';
         $prms['node'] = $video['vod_sort_id'];
         if (!$this->verify_self_prms($prms)) {
             $this->errorOutput('NO_PRIVILEGE');
             //$this->addItem(array('return' => 'fail'));
             //$this->output();
         }
     }
     foreach ($video as $k => $v) {
         if (is_string($v)) {
             $video[$k] = rawurldecode($v);
         }
     }
     $data = array('cur_clarity' => $vod_config['unique_id'], 'title' => $video['title'] ? $video['title'] : $this->dir_info['original'], 'source' => $video['source'], 'subtitle' => $video['subtitle'], 'keywords' => $video['keywords'], 'weight' => $video['weight'], 'comment' => $video['comment'], 'author' => $video['author'], 'vod_leixing' => $vod_leixing, 'bitrate' => $vod_config['video_bitrate'], 'vod_sort_id' => $video['vod_sort_id'], 'is_allow' => $video['is_mark'], 'starttime' => $video['starttime'] ? strtotime($video['starttime']) : '', 'hostwork' => defined("TARGET_VIDEO_DOMAIN") ? 'http://' . ltrim(TARGET_VIDEO_DOMAIN, 'http://') : $this->settings['videouploads']['protocol'] . $this->settings['videouploads']['host'], 'source_hostwork' => defined("SOURCE_VIDEO_DOMIAN") ? 'http://' . ltrim(SOURCE_VIDEO_DOMIAN, 'http://') : '', 'source_base_path' => UPLOAD_DIR, 'source_path' => rtrim($pathinfo['dirname'], '/') . '/', 'source_filename' => $pathinfo['basename'], 'video_base_path' => TARGET_DIR, 'video_path' => $this->dir_info['target_dir'], 'video_filename' => $this->dir_info['output_filename'] . '.' . $this->dir_info['output_format'], 'channel_id' => $channel_id, 'column_id' => $column_id, 'from_appid' => $this->user['appid'], 'from_appname' => $this->user['display_name'], 'user_id' => $video['_user_id'] ? $video['_user_id'] : ($this->input['user_id'] ? $this->input['user_id'] : $this->user['user_id']), 'addperson' => $video['_user_name'] ? $video['_user_name'] : ($this->input['user_name'] ? $this->input['user_name'] : $this->user['user_name']), 'org_id' => $this->input['org_id'] ? $this->input['org_id'] : $this->user['org_id'], 'create_time' => $create_time ? $create_time : TIMENOW, 'update_time' => TIMENOW, 'ip' => hg_getip(), 'app_uniqueid' => $video['app_uniqueid'] ? $video['app_uniqueid'] : 'livmedia', 'mod_uniqueid' => $video['mod_uniqueid'] ? $video['mod_uniqueid'] : MOD_UNIQUEID, 'morebitrate_config_id' => $video['vod_config_id'], 'template_sign' => $video['template_sign']);
     if ($video['is_time_shift']) {
         $sql = "UPDATE " . DB_PREFIX . "vodinfo SET ";
     } else {
         $sql = " INSERT INTO " . DB_PREFIX . "vodinfo SET ";
     }
     foreach ($data as $k => $v) {
         $sql .= " {$k} = '{$v}',";
     }
     $sql = trim($sql, ',');
     if ($video['is_time_shift']) {
         $sql .= ' WHERE id = ' . $video['id'];
     }
     $this->db->query($sql);
     if ($video['is_time_shift']) {
         $vid = $video['id'];
     } else {
         $vid = $this->db->insert_id();
     }
     //记录发布库栏目分发表
     $this->update_pub_column($vid, $video['column_id']);
     //记录发布库栏目分发表
     if ($video['index_pic']) {
         $material = new material();
         $img_info = $material->localMaterial($video['index_pic'], $vid);
         $img_info = $img_info[0];
     } else {
         //获取一张截图,并且提交到图片服务器
         $img_info = getimage(UPLOAD_DIR . $video['filepath'], TARGET_DIR . $this->dir_info['target_dir'], $vid);
         if (!$img_info || !$img_info['filename']) {
             if ($this->settings['App_live'] && $channel_id) {
                 include_once ROOT_PATH . 'lib/class/live.class.php';
                 $live = new live();
                 $channelinfo = $live->getChannelById($channel_id, 1, 1);
                 if ($channelinfo && $channelinfo[0] && $channelinfo[0]['snap']) {
                     $img_info = $channelinfo[0]['snap'];
                 }
             }
         }
     }
     if ($img_info && is_array($img_info)) {
         $image_info = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename'], 'imgwidth' => $img_info['imgwidth'], 'imgheight' => $img_info['imgheight']);
     } else {
         $image_info = array();
     }
     $sql = " UPDATE " . DB_PREFIX . "vodinfo SET video_order_id = {$vid},img_info = '" . serialize($image_info) . "'  WHERE id = {$vid}";
     $this->db->query($sql);
     //存储vod_extend表
     if ($video['content_id']) {
         $extend_data = array('vodinfo_id' => $vid, 'content_id' => $video['content_id'], 'extend_data' => $video['extend_data']);
         $sql = " INSERT INTO " . DB_PREFIX . "vod_extend SET ";
         foreach ($extend_data as $k => $v) {
             $sql .= " {$k} = '{$v}',";
         }
         $sql = trim($sql, ',');
         $this->db->query($sql);
     }
     //加入日志
     $data['id'] = $vid;
     $this->addLogs('创建视频', '', $data, $data['title']);
     return array('vid' => $vid, 'img_info' => $image_info);
 }
开发者ID:h3len,项目名称:Project,代码行数:95,代码来源:create.php

示例3: callback

 public function callback($video_id = 0)
 {
     if (!$video_id) {
         $video_id = intval($this->input['video_id']);
         if (!$video_id) {
             return false;
         }
     }
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'vod_extend WHERE content_id=' . $video_id;
     $local_video = $this->db->query_first($sql);
     if (!$local_video) {
         return false;
     }
     $this->user_unique = $this->settings['cloud_user'];
     $this->secret_key = $this->settings['cloud_secret_key'];
     $videoinfo = $this->videoGet($video_id);
     $videoinfo = json_decode($videoinfo, 1);
     if ($videoinfo['code'] == 109) {
         $sql = 'DELETE FROM ' . DB_PREFIX . 'vod_extend WHERE content_id=' . $video_id;
         $this->db->query($sql);
         $sql = 'DELETE FROM ' . DB_PREFIX . 'vodinfo WHERE id=' . intval($local_video['vodinfo_id']);
         $this->db->query($sql);
     }
     if (!$videoinfo['code']) {
         $sql = 'SELECT * FROM ' . DB_PREFIX . 'vodinfo WHERE  id=' . intval($local_video['vodinfo_id']);
         $local_video_info = $this->db->query_first($sql);
         $swf = $this->videoGetPlayinterface($this->user_unique, $local_video['extend_data'], 'flash');
         //				exit($swf);
         $data = array('totalsize' => $videoinfo['data']['video_duration'] * 1000, 'duration' => $videoinfo['data']['initial_size'], 'update_time' => time(), 'is_link' => 1, 'swf' => $swf);
         if (!$local_video_info['comment']) {
             $data['comment'] = $videoinfo['data']['video_desc'];
         }
         if (!$local_video_info['keywords']) {
             $data['keywords'] = $videoinfo['data']['tag'];
         }
         if ($videoinfo['data']['status'] == 10) {
             if ($local_video_info['status'] < 1) {
                 $data['status'] = 1;
             }
         } elseif ($videoinfo['data']['status'] == 20) {
             $data['status'] = -1;
         } else {
             if ($local_video_info['status'] == 2) {
                 $data['status'] = 1;
             }
         }
         $img_info = unserialize($local_video_info['img_info']);
         if (!strstr($videoinfo['data']['img'], 'noimg') || !$img_info['filename']) {
             include_once ROOT_PATH . 'lib/class/material.class.php';
             $material = new material();
             $imgurl = pathinfo($videoinfo['data']['img']);
             $imgurl = $imgurl['dirname'] . '/' . $imgurl['filename'] . '_640_360.' . $imgurl['extension'];
             $img_info = $material->localMaterial($imgurl);
             $img_info = $img_info[0];
             $image_info = array('host' => $img_info['host'], 'dir' => $img_info['dir'], 'filepath' => $img_info['filepath'], 'filename' => $img_info['filename'], 'imgwidth' => $img_info['imgwidth'], 'imgheight' => $img_info['imgheight']);
             $data['img_info'] = serialize($image_info);
         }
         if ($data) {
             $update = array();
             foreach ($data as $k => $v) {
                 $update[] = $k . "='" . $v . "'";
             }
             $sql = 'UPDATE ' . DB_PREFIX . 'vodinfo SET ' . implode(',', $update) . ' WHERE  id=' . intval($local_video_info['id']);
             $this->db->query($sql);
             return true;
         }
     }
     echo '<pre>';
     print_r($data);
     print_r($videoinfo);
     print_r($local_video_info);
     return false;
 }
开发者ID:h3len,项目名称:Project,代码行数:73,代码来源:LetvCloudV1.php

示例4: update_avatar

 /**
  *
  * 根据图片url更新头像
  * @param string $avatar_url 新头像链接
  * @param array $bind 原始头像数据
  */
 public function update_avatar($avatar_url, $bind, $member_id = 0, $is_enforce = false)
 {
     $attatch = array();
     $avatar_array = array();
     $old_avatar = array();
     $avatar_num = 0;
     include_once ROOT_PATH . 'lib/class/material.class.php';
     $mMaterial = new material();
     if (!$mMaterial) {
         return false;
     }
     if ($member_id && !$is_enforce) {
         $sql = 'SELECT count(member_id) as total FROM ' . DB_PREFIX . 'member as m WHERE m.member_id = ' . $member_id . ' AND ( m.avatar != \'\' AND m.avatar !=\'a:0:{}\')';
         $avatar_total = $this->db->query_first($sql);
         $avatar_num = intval($avatar_total['total']);
     }
     if ($avatar_url) {
         if ((empty($bind) || empty($bind['avatar'])) && !$member_id || !$avatar_num && $member_id) {
             $attatch = $mMaterial->localMaterial($avatar_url, $member_id, 0, 0);
             $attatch = $attatch[0];
             if (!$attatch['error']) {
                 $avatar_array = array('host' => $attatch['host'], 'dir' => $attatch['dir'], 'filepath' => $attatch['filepath'], 'filename' => $attatch['filename']);
             }
         }
         //else {
         //$old_avatar = $bind['avatar'];
         //$attatch = $mMaterial->replaceImg(hg_fetchimgurl($old_avatar),$avatar_url);
         //	}
     }
     return $avatar_array;
 }
开发者ID:h3len,项目名称:Project,代码行数:37,代码来源:member.class.php

示例5: create_thumb

 public function create_thumb($url, $cid = 0)
 {
     $material = new material();
     $img_info = $material->localMaterial($url, $cid);
     return $img_info[0];
 }
开发者ID:h3len,项目名称:Project,代码行数:6,代码来源:vod_update.php

示例6: image2material

 private function image2material($path, $cid)
 {
     $material = new material();
     $img_info = $material->localMaterial($path, $cid);
     return $img_info[0];
 }
开发者ID:h3len,项目名称:Project,代码行数:6,代码来源:import_vod.php

示例7: getimage

function getimage($source_path, $targerdir, $cid)
{
    $snapobj = new SnapFromVideo();
    $path = $snapobj->snapPicture($source_path, $targerdir);
    if ($path) {
        $material = new material();
        $img_info = $material->localMaterial($path, $cid);
        return $img_info[0];
    }
    return false;
}
开发者ID:h3len,项目名称:Project,代码行数:11,代码来源:functions.php

示例8: localMaterial

 public function localMaterial()
 {
     if (!trim($this->input['url'])) {
         $this->errorOutput('没有图片url');
     }
     $material = new material();
     $fileinfo = $material->localMaterial(trim($this->input['url']), 0, 0, -1);
     //插入图片服务器
     if (!$fileinfo) {
         $this->errorOutput('图片本地化失败');
     }
     $this->addItem($fileinfo);
     $this->output();
 }
开发者ID:h3len,项目名称:Project,代码行数:14,代码来源:user.php

示例9: count

	 * @param Array $data
	 */
    public function count($data)
    {
        $condition = $this->get_condition($data);
        $sql = 'SELECT COUNT(id) AS total FROM ' . DB_PREFIX . 'message WHERE 1';
        if ($condition) {
            $sql .= $condition;
        }
        return $this->db->query_first($sql);
    }
    /**
	 * 获取单个微信信息
	 * @param Int $id
	 */
    public function detail($id)
    {
开发者ID:h3len,项目名称:Project,代码行数:17,代码来源:wx.class.php


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