本文整理汇总了PHP中dd2char函数的典型用法代码示例。如果您正苦于以下问题:PHP dd2char函数的具体用法?PHP dd2char怎么用?PHP dd2char使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dd2char函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFileUrl
function GetFileUrl(
$aid,$typeid,$timetag,$title,$ismake=0,$rank=0,
$namerule="",$artdir="",$money=0,$aburl=false,$siteurl="")
{
if($rank!=0||$ismake==-1||$typeid==0||$money>0) //动态文章
{
if($GLOBALS['cfg_multi_site']=='Y')
{
$siteurl = $GLOBALS['cfg_basehost'];
}
return $siteurl.$GLOBALS['cfg_plus_dir']."/view.php?aid=$aid";
}
else
{
$articleRule = $namerule;
$articleDir = MfTypedir($artdir);
if($namerule=="") $articleRule = $GLOBALS['cfg_df_namerule'];
if($artdir=="") $articleDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_arcdir'];
$dtime = GetDateMk($timetag);
$articleRule = strtolower($articleRule);
list($y,$m,$d) = explode("-",$dtime);
$articleRule = str_replace("{typedir}",$articleDir,$articleRule);
$articleRule = str_replace("{y}",$y,$articleRule);
$articleRule = str_replace("{m}",$m,$articleRule);
$articleRule = str_replace("{d}",$d,$articleRule);
$articleRule = str_replace("{timestamp}",$timetag,$articleRule);
$articleRule = str_replace("{aid}",$aid,$articleRule);
$articleRule = str_replace("{cc}",dd2char($m.$d.$aid.$y),$articleRule);
if(ereg('{p',$articleRule)){
$articleRule = str_replace("{pinyin}",GetPinyin($title)."_".$aid,$articleRule);
$articleRule = str_replace("{py}",GetPinyin($title,1)."_".$aid,$articleRule);
}
$articleUrl = "/".ereg_replace("^/","",$articleRule);
//是否强制使用绝对网址
if($aburl && $GLOBALS['cfg_multi_site']=='Y'){
if($siteurl=="") $siteurl = $GLOBALS["cfg_basehost"];
$articleUrl = $siteurl.$articleUrl;
}
return $articleUrl;
}
}
示例2: MemberUploads
function MemberUploads($upname, $handname, $userid = 0, $utype = 'image', $exname = '', $maxwidth = 0, $maxheight = 0, $water = false, $isadmin = false)
{
global $cfg_imgtype, $cfg_mb_addontype, $cfg_mediatype, $cfg_user_dir, $cfg_basedir, $cfg_dir_purview;
//当为游客投稿的情况下,这个 id 为 0
if (empty($userid)) {
$userid = 0;
}
if (!is_dir($cfg_basedir . $cfg_user_dir . "/{$userid}")) {
MkdirAll($cfg_basedir . $cfg_user_dir . "/{$userid}", $cfg_dir_purview);
CloseFtp();
}
//有上传文件
$allAllowType = str_replace('||', '|', $cfg_imgtype . '|' . $cfg_mediatype . '|' . $cfg_mb_addontype);
if (!empty($GLOBALS[$upname]) && is_uploaded_file($GLOBALS[$upname])) {
$nowtme = time();
$GLOBALS[$upname . '_name'] = trim(ereg_replace("[ \r\n\t\\*\\%\\/\\?><\\|\":]{1,}", '', $GLOBALS[$upname . '_name']));
//源文件类型检查
if ($utype == 'image') {
if (!eregi("\\.(" . $cfg_imgtype . ")\$", $GLOBALS[$upname . '_name'])) {
ShowMsg("你所上传的图片类型不在许可列表,请上传{$cfg_imgtype}类型!", '-1');
exit;
}
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp");
$imgfile_type = strtolower(trim($GLOBALS[$upname . '_type']));
if (!in_array($imgfile_type, $sparr)) {
ShowMsg('上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!', '-1');
exit;
}
} else {
if ($utype == 'flash' && !eregi("\\.swf\$", $GLOBALS[$upname . '_name'])) {
ShowMsg('上传的文件必须为flash文件!', '-1');
exit;
} else {
if ($utype == 'media' && !eregi("\\.(" . $cfg_mediatype . ")\$", $GLOBALS[$upname . '_name'])) {
ShowMsg('你所上传的文件类型必须为:' . $cfg_mediatype, '-1');
exit;
} else {
if (!eregi("\\.(" . $allAllowType . ")\$", $GLOBALS[$upname . '_name'])) {
ShowMsg("你所上传的文件类型不被允许!", '-1');
exit;
}
}
}
}
//再次严格检测文件扩展名是否符合系统定义的类型
$fs = explode('.', $GLOBALS[$upname . '_name']);
$sname = $fs[count($fs) - 1];
$alltypes = explode('|', $allAllowType);
if (!in_array(strtolower($sname), $alltypes)) {
ShowMsg('你所上传的文件类型不被允许!', '-1');
exit;
}
//强制禁止的文件类型
if (eregi("\\.(asp|php|pl|cgi|shtm|js)", $sname)) {
ShowMsg('你上传的文件为系统禁止的类型!', '-1');
exit;
}
if ($exname == '') {
$filename = $cfg_user_dir . "/{$userid}/" . dd2char($nowtme . '-' . mt_rand(1000, 9999)) . '.' . $sname;
} else {
$filename = $cfg_user_dir . "/{$userid}/{$exname}." . $sname;
}
move_uploaded_file($GLOBALS[$upname], $cfg_basedir . $filename) or die("上传文件到 {$filename} 失败!");
@unlink($GLOBALS[$upname]);
if (@filesize($cfg_basedir . $filename) > $GLOBALS['cfg_mb_upload_size'] * 1024) {
@unlink($cfg_basedir . $filename);
ShowMsg('你上传的文件超出系统大小限制!', '-1');
exit;
}
//加水印或缩小图片
if ($utype == 'image') {
include_once DEDEINC . '/image.func.php';
if ($maxwidth > 0 || $maxheight > 0) {
ImageResize($cfg_basedir . $filename, $maxwidth, $maxheight);
} else {
if ($water) {
WaterImg($cfg_basedir . $filename);
}
}
}
return $filename;
} else {
//强制禁止的文件类型
if ($handname == '') {
return $handname;
} else {
if (eregi("\\.(asp|php|pl|cgi|shtm|js)", $handname)) {
exit('Not allow filename for not safe!');
} else {
if (!eregi("\\.(" . $allAllowType . ")\$", $handname)) {
exit('Not allow filename for filetype!');
} else {
if (!eregi('^http:', $handname) && !eregi('^' . $cfg_user_dir . '/' . $userid, $handname) && !$isadmin) {
exit('Not allow filename for not userdir!');
}
}
}
}
return $handname;
}
//.........这里部分代码省略.........
示例3: if
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}else{
$sname = '.jpg';
}
$nowtime = time();
$savepath = $cfg_user_dir."/".$cfg_ml->M_ID;
CreateDir($savepath);
CloseFtp();
$rndname = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999));
$filename = $savepath."/".$rndname;
$rndname = $rndname.$sname; //仅作注解用
//大小图URL
$bfilename = $filename.$sname;
$litfilename = $filename."_lit".$sname;
//大小图真实地址
$fullfilename = $cfg_basedir.$bfilename;
$full_litfilename = $cfg_basedir.$litfilename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请重试!","-1");
exit();
}
示例4: GetRndName
/**
* 获得下载媒体的随机名称
*
* @access public
* @param string $url 地址
* @param string $v 值
* @return string
*/
function GetRndName($url, $v)
{
global $cfg_image_dir, $cfg_dir_purview;
$this->mediaCount++;
$mnum = $this->mediaCount;
$timedir = "c" . MyDate("ymd", time());
//存放路径
$fullurl = preg_replace("#\\/{1,}#", "/", $cfg_image_dir . "/");
if (!is_dir($GLOBALS['cfg_basedir'] . "/{$fullurl}")) {
MkdirAll($GLOBALS['cfg_basedir'] . "/{$fullurl}", $cfg_dir_purview);
}
$fullurl = $fullurl . $timedir . "/";
if (!is_dir($GLOBALS['cfg_basedir'] . "/{$fullurl}")) {
MkdirAll($GLOBALS['cfg_basedir'] . "/{$fullurl}", $cfg_dir_purview);
}
//文件名称
$timename = str_replace('.', '', ExecTime());
$threadnum = 0;
if (isset($_GET['threadnum'])) {
$threadnum = intval($_GET['threadnum']);
}
$filename = dd2char($timename . $threadnum . '-' . $mnum . mt_rand(1000, 9999));
//分配扩展名
$urls = explode('.', $url);
if ($v == 'img') {
$shortname = '.jpg';
if (preg_match("#\\.gif\$#i", $url)) {
$shortname = '.gif';
} else {
if (preg_match("#\\.png\$#i", $url)) {
$shortname = '.png';
}
}
} else {
if ($v == 'embed') {
$shortname = '.swf';
} else {
$shortname = '';
}
}
$fullname = $fullurl . $filename . $shortname;
return preg_replace("#\\/{1,}#", "/", $fullname);
}
示例5: UploadOneImage
/**
* 上传一个未经处理的图片
*
* @access public
* @param string $upname 上传框名称
* @param string $handurl 手工填写的网址
* @param string $ddisremote 是否下载远程图片 0 不下, 1 下载
* @param string $ntitle 注解文字 如果表单有 title 字段可不管
* @return mixed
*/
function UploadOneImage($upname, $handurl = '', $isremote = 1, $ntitle = '')
{
global $cuserLogin, $cfg_basedir, $cfg_image_dir, $title, $dsql;
if ($ntitle != '') {
$title = $ntitle;
}
$ntime = time();
$filename = '';
$isrm_up = FALSE;
$handurl = trim($handurl);
//如果用户自行上传了图片
if (!empty($_FILES[$upname]['tmp_name']) && is_uploaded_file($_FILES[$upname]['tmp_name'])) {
$istype = 0;
$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png");
$_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type']));
if (!in_array($_FILES[$upname]['type'], $sparr)) {
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!", "-1");
exit;
}
if (!empty($handurl) && !preg_match("#^http:\\/\\/#i", $handurl) && file_exists($cfg_basedir . $handurl)) {
if (!is_object($dsql)) {
$dsql = new DedeSql();
}
$dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$handurl}' ");
$fullUrl = preg_replace("#\\.([a-z]*)\$#i", "", $handurl);
} else {
$savepath = $cfg_image_dir . '/' . strftime("%Y-%m", $ntime);
CreateDir($savepath);
$fullUrl = $savepath . '/' . strftime("%d", $ntime) . dd2char(strftime("%H%M%S", $ntime) . '0' . $cuserLogin->getUserID() . '0' . mt_rand(1000, 9999));
}
if (strtolower($_FILES[$upname]['type']) == "image/gif") {
$fullUrl = $fullUrl . ".gif";
} else {
if (strtolower($_FILES[$upname]['type']) == "image/png") {
$fullUrl = $fullUrl . ".png";
} else {
$fullUrl = $fullUrl . ".jpg";
}
}
//保存
@move_uploaded_file($_FILES[$upname]['tmp_name'], $cfg_basedir . $fullUrl);
$filename = $fullUrl;
//水印
@WaterImg($imgfile, 'up');
$isrm_up = TRUE;
} else {
if ($handurl == '') {
return '';
}
//远程图片并要求本地化
if ($isremote == 1 && preg_match("#^http:\\/\\/#i", $handurl)) {
$ddinfos = GetRemoteImage($handurl, $cuserLogin->getUserID());
if (!is_array($ddinfos)) {
$litpic = "";
} else {
$filename = $ddinfos[0];
}
$isrm_up = TRUE;
//本地图片或远程不要求本地化
} else {
$filename = $handurl;
}
}
$imgfile = $cfg_basedir . $filename;
if (is_file($imgfile) && $isrm_up && $filename != '') {
$info = "";
$imginfos = GetImageSize($imgfile, $info);
//把新上传的图片信息保存到媒体文档管理档案中
$inquery = "\n INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid)\n VALUES ('{$title}','{$filename}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . time() . "','" . $cuserLogin->getUserID() . "');\n ";
$dsql->ExecuteNoneQuery($inquery);
}
return $filename;
}
示例6: cn_substr
$tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16);
$ntime = time();
if (file_exists($zipfile)) {
@mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile, $tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs);
$i = 0;
foreach ($imgs as $imgold) {
$i++;
$savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime);
CreateDir($savepath);
$iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999));
$iurl = $iurl . substr($imgold, -4, 4);
$imgfile = $cfg_basedir . $iurl;
copy($imgold, $imgfile);
unlink($imgold);
if (is_file($imgfile)) {
$litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl;
//指定了提取第一张为缩略图的情况强制使用第一张缩略图
if ($i == '1') {
if (!$hasone && $ddisfirst == 1 && $litpic == '' && empty($litpicname)) {
$litpicname = GetImageMapDD($iurl, $cfg_ddimg_width);
}
}
$info = '';
$imginfos = GetImageSize($imgfile, $info);
$imgurls .= "{dede:img ddimg='{$litpicname}' text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}\r\n";
示例7: GetFileName
function GetFileName($aid, $typeid, $timetag, $title, $ismake = 0, $rank = 0, $namerule = '', $typedir = '', $money = 0, $filename = '')
{
global $cfg_rewrite, $cfg_cmspath, $cfg_arcdir, $cfg_special, $cfg_arc_dirname;
//没指定栏目时用固定规则(专题)
if (empty($namerule)) {
$namerule = $cfg_special . '/arc-{aid}.html';
$typeid = -1;
}
if ($rank != 0 || $ismake == -1 || $typeid == 0 || $money > 0) {
//动态文章
if ($cfg_rewrite == 'Y') {
return $GLOBALS["cfg_plus_dir"] . "/view-" . $aid . '-1.html';
} else {
return $GLOBALS['cfg_phpurl'] . "/view.php?aid={$aid}";
}
} else {
$articleDir = MfTypedir($typedir);
$articleRule = strtolower($namerule);
if ($articleRule == '') {
$articleRule = strtolower($GLOBALS['cfg_df_namerule']);
}
if ($typedir == '') {
$articleDir = $GLOBALS['cfg_cmspath'] . $GLOBALS['cfg_arcdir'];
}
$dtime = GetDateMk($timetag);
list($y, $m, $d) = explode('-', $dtime);
$arr_rpsource = array('{typedir}', '{y}', '{m}', '{d}', '{timestamp}', '{aid}', '{cc}');
$arr_rpvalues = array($articleDir, $y, $m, $d, $timetag, $aid, dd2char($m . $d . $aid . $y));
if ($filename != '') {
$articleRule = dirname($articleRule) . '/' . $filename . $GLOBALS['cfg_df_ext'];
}
$articleRule = str_replace($arr_rpsource, $arr_rpvalues, $articleRule);
if (preg_match("/\\{p/", $articleRule)) {
$articleRule = str_replace('{pinyin}', GetPinyin($title) . '_' . $aid, $articleRule);
$articleRule = str_replace('{py}', GetPinyin($title, 1) . '_' . $aid, $articleRule);
}
$articleUrl = '/' . preg_replace("/^\\//", '', $articleRule);
if (preg_match("/index\\.html/", $articleUrl) && $cfg_arc_dirname == 'Y') {
$articleUrl = str_replace('index.html', '', $articleUrl);
}
return $articleUrl;
}
}
示例8: GetRndName
function GetRndName($url,$v)
{
global $threadnum;
$this->MediaCount++;
$mnum = $this->MediaCount;
$timedir = strftime("%y%m%d",time());
//存放路径
$fullurl = preg_replace("/\/{1,}/","/",$this->Item["imgurl"]."/");
if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
$fullurl = $fullurl.$timedir."/";
if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) MkdirAll($GLOBALS['cfg_basedir']."/$fullurl",$GLOBALS['cfg_dir_purview']);
//文件名称
$timename = str_replace(".","",ExecTime());
$nthreadnum =(!empty($threadnum) ? $threadnum : 0);
$filename = $timename.$nthreadnum.$mnum.mt_rand(1000,9999);
//把适合的数字转为字母
$filename = dd2char($filename);
//分配扩展名
$urls = explode(".",$url);
if($v=="img"){
$shortname = ".jpg";
if(eregi("\.gif\?(.*)$",$url) || eregi("\.gif$",$url)) $shortname = ".gif";
else if(eregi("\.png\?(.*)$",$url) || eregi("\.png$",$url)) $shortname = ".png";
}
else if($v=="embed") $shortname = ".swf";
else $shortname = "";
//-----------------------------------------
$fullname = $fullurl.$filename.$shortname;
return preg_replace("/\/{1,}/","/",$fullname);
}
示例9: exit
$sname = '.bmp';
break;
}
}
if ($ftype == '') {
@unlink($Filedata);
echo "ERROR: Image type Error! ";
exit(0);
}
//保存原图
$filedir = $cfg_image_dir . '/' . MyDate($cfg_addon_savetype, time());
if (!is_dir(DEDEROOT . $filedir)) {
MkdirAll($cfg_basedir . $filedir, $cfg_dir_purview);
CloseFtp();
}
$filename = $cuserLogin->getUserID() . '-' . dd2char(MyDate('ymdHis', time()));
if (file_exists($cfg_basedir . $filedir . '/' . $filename . $sname)) {
for ($i = 50; $i <= 5000; $i++) {
if (!file_exists($cfg_basedir . $filedir . '/' . $filename . '-' . $i . $sname)) {
$filename = $filename . '-' . $i;
break;
}
}
}
$fileurl = $filedir . '/' . $filename . $sname;
$rs = copy($FiledataNew, $cfg_basedir . $fileurl);
unlink($FiledataNew);
if (!$rs) {
echo "ERROR: Copy Uploadfile Error! ";
exit(0);
}
示例10: UploadOneImage
function UploadOneImage($upname,$handurl='',$ddisremote=1,$ntitle='')
{
global $cuserLogin,$cfg_basedir,$cfg_image_dir,$dsql,$title;
if($ntitle!='') $title = $ntitle;
$ntime = time();
$filename = '';
$isrm_up = false;
$handurl = trim($handurl);
//如果用户自行上传了图片
if(!empty($_FILES[$upname]['tmp_name']) && is_uploaded_file($_FILES[$upname]['tmp_name']))
{
$istype = 0;
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png");
$_FILES[$upname]['type'] = strtolower(trim($_FILES[$upname]['type']));
if(!in_array($_FILES[$upname]['type'],$sparr)){
ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1");
exit();
}
if(!empty($handurl) && !eregi("^http://",$handurl) && file_exists($cfg_basedir.$handurl) ){
if(!is_object($dsql)) $dsql = new DedeSql();
$dsql->ExecuteNoneQuery("Delete From #@__uploads where url like '$handurl' ");
$fullUrl = eregi_replace("\.([a-z]*)$","",$handurl);
}else{
$savepath = $cfg_image_dir."/".strftime("%Y-%m",$ntime);
CreateDir($savepath);
$fullUrl = $savepath."/".strftime("%d",$ntime).dd2char(strftime("%H%M%S",$ntime).'0'.$cuserLogin->getUserID().'0'.mt_rand(1000,9999));
}
if(strtolower($_FILES[$upname]['type'])=="image/gif") $fullUrl = $fullUrl.".gif";
else if(strtolower($_FILES[$upname]['type'])=="image/png") $fullUrl = $fullUrl.".png";
else $fullUrl = $fullUrl.".jpg";
//保存
@move_uploaded_file($_FILES[$upname]['tmp_name'],$cfg_basedir.$fullUrl);
$filename = $fullUrl;
//水印
@WaterImg($imgfile,'up');
$isrm_up = true;
}
//远程或选择本地图片
else{
if($handurl=='') return '';
//远程图片并要求本地化
if($isremote==1 && eregi("^http://",$handurl)){
$ddinfos = GetRemoteImage($handurl,$cuserLogin->getUserID());
if(!is_array($ddinfos)) $litpic = "";
else $filename = $ddinfos[0];
$isrm_up = true;
//本地图片或远程不要求本地化
}else{
$filename = $handurl;
}
}
$imgfile = $cfg_basedir.$filename;
if(is_file($imgfile) && $isrm_up && $filename!=''){
$info = "";
$imginfos = GetImageSize($imgfile,$info);
//把新上传的图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('$title','$filename','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".time()."','".$cuserLogin->getUserID()."','0');
";
$dsql = new DedeSql(false);
$dsql->ExecuteNoneQuery($inquery);
}
return $filename;
}
示例11: zip
@mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']);
@chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']);
$z = new zip();
$z->ExtractAll($zipfile,$tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs);
$i = 0;
foreach($imgs as $imgold)
{
$i++;
$savepath = $cfg_image_dir."/".strftime("%Y-%m",$ntime);
CreateDir($savepath);
$iurl = $savepath."/".strftime("%d",$ntime).dd2char(strftime("%H%M%S",$ntime).'-'.$adminID."-{$i}".mt_rand(1000,9999));
$iurl = $iurl.substr($imgold,-4,4);
$imgfile = $cfg_basedir.$iurl;
copy($imgold,$imgfile);
unlink($imgold);
if(is_file($imgfile))
{
$litpicname = GetImageMapDD($iurl,$ddmaxwidth);
$info = '';
$imginfos = GetImageSize($imgfile,$info);
$imgurls .= "{dede:img ddimg='$litpicname' text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
//把图片信息保存到媒体文档管理档案中
$inquery = "
INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,adminid,memberid)
VALUES ('{$title}','{$iurl}','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".$ntime."','$adminID','0');
";
示例12: CloseFtp
CloseFtp();
}
$sname = '.jpg';
//图片的限定扩展名
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}
$filename_name = $cfg_ml->M_ID."_".dd2char(strftime("%H%M%S",$nowtme).mt_rand(100,999));
$filename = $mdir."/".$filename_name;
$filename = $filename.$sname;
$filename_name = $filename_name.$sname;
$fullfilename = $cfg_basedir.$activepath."/".$filename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请更改!","-1");
exit();
}
if(!eregi("\.(jpg|gif|png|bmp)$",$fullfilename)){
ShowMsg("你所上传的文件类型被禁止,系统只允许上传jpg、gif、png、bmp类型图片!","-1");
exit();
}
示例13: GetUpImage
function GetUpImage($litpic,$isdd=false,$exitErr=false,$iw=0,$ih=0,$iname='')
{
global $cfg_ml,$cfg_ddimg_width,$cfg_ddimg_height;
global $cfg_basedir,$cfg_user_dir,$title,$cfg_mb_upload_size,$cfg_photo_typenames;
if($iw==0) $iw = $cfg_ddimg_width;
if($ih==0) $ih = $cfg_ddimg_height;
$ntime = $nowtme = mytime();
if(!isset($_FILES[$litpic])) return "";
if(is_uploaded_file($_FILES[$litpic]['tmp_name']))
{
//超过限定大小的文件不给上传
if($_FILES[$litpic]['size'] > $cfg_mb_upload_size*1024){
@unlink($_FILES[$litpic]['tmp_name']);
return "";
}
$sparr = $cfg_photo_typenames;
$_FILES[$litpic]['type'] = strtolower(trim($_FILES[$litpic]['type']));
if(!in_array($_FILES[$litpic]['type'],$sparr)){
if($exitErr){
ShowMsg("上传的缩略图片格式错误,请使用JPEG、GIF、PNG格式的其中一种!","-1");
exit();
}else{ return ""; }
}
$savepath = $cfg_user_dir."/".$cfg_ml->M_ID;
CreateDir($savepath);
if($iname=='') $itname = dd2char($cfg_ml->M_ID."0".strftime("%y%m%d%H%M%S",$nowtme)."0".mt_rand(1000,9999)).'-lit';
else $itname = $iname;
$fullUrl = $savepath."/".$itname;
//强制检测文件类型
if($iname==''){
if(strtolower($_FILES[$litpic]['type'])=="image/gif") $fullUrl = $fullUrl.".gif";
else if(strtolower($_FILES[$litpic]['type'])=="image/png") $fullUrl = $fullUrl.".png";
else $fullUrl = $fullUrl.".jpg";
}else{
$fullUrl = $fullUrl.'.jpg';
}
@move_uploaded_file($_FILES[$litpic]['tmp_name'],$cfg_basedir.$fullUrl);
$litpic = $fullUrl;
if($isdd) @ImageResize($cfg_basedir.$fullUrl,$iw,$ih);
else @WaterImg($cfg_basedir.$fullUrl,'up');
//保存用户上传的记录到数据库
if($title==''){
if($isdd) $title = '用户上传的图片';
else $title = '用户上传的略略图';
}
$info = "";
$datas[0] = 0;
$datas[1] = 0;
$datas = GetImageSize($cfg_basedir.$fullUrl,$info);
$addinfos[0] = $datas[0];
$addinfos[1] = $datas[1];
$addinfos[2] = filesize($cfg_basedir.$fullUrl);
SaveUploadInfo($title,$fullUrl,1,$addinfos);
return $litpic;
}else{
return "";
}
}
示例14: GetImageSize
$imginfos = GetImageSize($imgfile,$info);
$imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n";
}
}
//直接上传的图片
}else
{
$sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png","image/x-png","image/wbmp");
if(!in_array($_FILES['imgfile'.$i]['type'],$sparr)){
continue;
}
$uptime = time();
$imgPath = $cfg_image_dir."/".strftime("%y%m%d",$uptime);
MkdirAll($cfg_basedir.$imgPath,$GLOBALS['cfg_dir_purview']);
CloseFtp();
$filename = $imgPath."/".dd2char($cuserLogin->getUserID().strftime("%H%M%S",$uptime).mt_rand(1000,9999))."-{$i}";
$fs = explode(".",$_FILES['imgfile'.$i]['name']);
$filename = $filename.".".$fs[count($fs)-1];
@move_uploaded_file($_FILES['imgfile'.$i]['tmp_name'],$cfg_basedir.$filename);
//缩图
$litpicname = GetImageMapDD($filename,$ddmaxwidth);
//水印
$imgfile = $cfg_basedir.$filename;
@WaterImg($imgfile,'up');
if(is_file($imgfile)){
$iurl = $filename;
$info = "";
$imginfos = GetImageSize($imgfile,$info);
示例15: if
//上传后的图片的处理
if($imgfile_type=='image/pjpeg'||$imgfile_type=='image/jpeg'){
$sname = '.jpg';
}else if($imgfile_type=='image/gif'){
$sname = '.gif';
}else if($imgfile_type=='image/png'){
$sname = '.png';
}else if($imgfile_type=='image/wbmp'){
$sname = '.bmp';
}
$nowtime = time();
$savepath = $cfg_user_dir."/".$cfg_ml->M_ID."/".strftime("%y%m",$nowtime);
CreateDir($savepath);
CloseFtp();
$rndname = dd2char(strftime("%d%H%M%S",$nowtime).$cfg_ml->M_ID.mt_rand(1000,9999));
$filename = $savepath."/".$rndname;
$rndname = $rndname.$sname; //仅作注解用
//大小图URL
$bfilename = $filename.$sname;
$litfilename = $filename."_lit".$sname;
//大小图真实地址
$fullfilename = $cfg_basedir.$bfilename;
$full_litfilename = $cfg_basedir.$litfilename;
if(file_exists($fullfilename)){
ShowMsg("本目录已经存在同名的文件,请重试!","-1");
exit();
}