/** * 图集里大图的小图 * * @access public * @param string $filename 图片名称 * @param string $maxwidth 最大宽度 * @return string */ function GetImageMapDD($filename, $maxwidth) { global $cuserLogin, $dsql, $cfg_ddimg_height, $cfg_ddimg_full; $ddn = substr($filename, -3); $ddpicok = preg_replace("#\\." . $ddn . "\$#", "-lp." . $ddn, $filename); $toFile = $GLOBALS['cfg_basedir'] . $ddpicok; if ($cfg_ddimg_full == 'Y') { ImageResizeNew($GLOBALS['cfg_basedir'] . $filename, $maxwidth, $cfg_ddimg_height, $toFile); } else { ImageResize($GLOBALS['cfg_basedir'] . $filename, $maxwidth, $cfg_ddimg_height, $toFile); } //保存图片附件信息 $fsize = filesize($toFile); $ddpicoks = explode('/', $ddpicok); $filename = $ddpicoks[count($ddpicoks) - 1]; $inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)\n VALUES ('0','{$filename}','{$ddpicok}','1','0','0','0','{$fsize}','" . time() . "','" . $cuserLogin->getUserID() . "'); "; $dsql->ExecuteNoneQuery($inquery); $fid = $dsql->GetLastID(); AddMyAddon($fid, $ddpicok); return $ddpicok; }
} else { if ($dopost == 'addtoedit') { if (!isset($_SESSION['bigfile_info'][$id])) { echo ''; exit; } echo $_SESSION['bigfile_info'][$id]; exit; } else { if ($dopost == 'ddimg') { //生成缩略图 ob_start(); if (!preg_match("/^(http:\\/\\/)?([^\\/]+)/i", $img)) { $img = $cfg_basedir . $img; } ImageResizeNew($img, $cfg_ddimg_width, $cfg_ddimg_height, '', false); $imagevariable = ob_get_contents(); ob_end_clean(); header('Content-type: image/jpeg'); header('Content-Length: ' . strlen($imagevariable)); echo $imagevariable; exit; } else { if ($dopost == 'delold') { $imgfile = $cfg_basedir . $picfile; if (!file_exists($imgfile) && !is_dir($imgfile) && preg_match("#^" . $cfg_medias_dir . "#", $imgfile)) { @unlink($imgfile); } $dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$picfile}'; "); echo "<b>已删除!</b>"; exit;
if(!is_array($imginfos)) { $imginfos = @GetImageSize($imgfile, $info); $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; continue; } move_uploaded_file($tmpFile, $imgfile); $imginfos = @GetImageSize($imgfile, $info); if($ddurl==$iurl) { $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; $litimgfile = $cfg_basedir.$litpicname; } else { if($cfg_ddimg_full=='Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); else ImageResize($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); $litpicname = $ddurl; } $imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; } //没上传图片(只修改msg信息) else { $iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i})); $iurl = stripslashes(${'imgurl'.$i}); $ddurl = stripslashes(${'imgddurl'.$i}); if(preg_match("#swfupload#i", $ddurl)) { $ddurl = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; }
$tmpFile = ${'imgfile' . $i}; //检测上传的图片, 如果类型不对,保留原来图片 $imginfos = @GetImageSize($tmpFile, $info); if (!is_array($imginfos)) { $imginfos = @GetImageSize($imgfile, $info); $imgurls .= "{dede:img ddimg='{$ddurl}' text='{$iinfo}' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}\r\n"; continue; } move_uploaded_file($tmpFile, $imgfile); $imginfos = @GetImageSize($imgfile, $info); if ($ddurl == $iurl) { $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; $litimgfile = $cfg_basedir . $litpicname; } else { if ($cfg_ddimg_full == 'Y') { ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); } else { ImageResize($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); } $litpicname = $ddurl; } $imgurls .= "{dede:img ddimg='{$litpicname}' text='{$iinfo}' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}\r\n"; } else { $iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i})); $iurl = stripslashes(${'imgurl' . $i}); $ddurl = stripslashes(${'imgddurl' . $i}); if (preg_match("#swfupload#i", $ddurl)) { $ddurl = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; } $imginfos = @GetImageSize($imgfile, $info); $imgurls .= "{dede:img ddimg='{$ddurl}' text='{$iinfo}' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} {$iurl} {/dede:img}\r\n";
$bfilename = $cfg_image_dir . "/{$y}/" . $filename . "." . $fs[count($fs) - 1]; $litfilename = $cfg_image_dir . "/{$y}/" . $filename . "_lit." . $fs[count($fs) - 1]; $dbbigfile = $filename . "." . $fs[count($fs) - 1]; $dblitfile = $filename . "_lit." . $fs[count($fs) - 1]; $fullfilename = $cfg_basedir . $bfilename; $full_litfilename = $cfg_basedir . $litfilename; if (file_exists($fullfilename)) { ShowMsg("本目录已经存在同名的文件,请更改!", "-1"); exit; } @move_uploaded_file($imgfile, $fullfilename); if ($dd == 'yes') { copy($fullfilename, $full_litfilename); if (in_array($imgfile_type, $cfg_photo_typenames)) { if ($GLOBALS['cfg_ddimg_full'] == 'Y') { @ImageResizeNew($full_litfilename, $w, $h); } else { @ImageResize($full_litfilename, $w, $h); } } $urlValue = $bfilename; $imgsrcValue = $litfilename; $info = ''; $sizes = getimagesize($full_litfilename, $info); $imgwidthValue = $sizes[0]; $imgheightValue = $sizes[1]; $imgsize = filesize($full_litfilename); $inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid)\r\n VALUES ('小图{$dblitfile}','{$imgsrcValue}','1','{$imgwidthValue}','{$imgheightValue}','0','{$imgsize}','{$nowtme}','" . $cuserLogin->getUserID() . "');\r\n \t"; $dsql->ExecuteNoneQuery($inquery); $fid = $dsql->GetLastID(); AddMyAddon($fid, $imgsrcValue);