织梦CMS系统图集上传图片默认是要手动填写注释的,有时我们做好了产品图和图片名称,为了方便想让上传图片后自动获取图片名做注释 织梦教程开始 1、打开 /dede/swfupload.php 找到,大概在137行 echo FILEID: . $_SESSION [ fileid ]; 在它的上面加入 $ file_snames = explode( . , $Filename ); $ file_filename = $file_snames [count( $file_snames )-2]; $ _S […]
织梦CMS系统图集上传图片默认是要手动填写注释的,有时我们做好了产品图和图片名称,为了方便想让上传图片后自动获取图片名做注释
织梦教程开始
1、打开 /dede/swfupload.php 找到,大概在137行
echo "FILEID:".$_SESSION['fileid'];
在它的上面加入
$file_snames = explode('.', $Filename);
$file_filename = $file_snames[count($file_snames)-2];
$_SESSION['file_filename'][$_SESSION['fileid']] = $file_filename;
继续找到
在它的上面加入
/
//生成注释
function GetThumbnail(){ }
/
else if($dopost=='thumbalt')
{
if( empty($id) )
{
header('HTTP/1.1 500 Internal Server Error');
echo 'No ID';
exit(0);
}
if (!is_array($_SESSION['file_filename']) || !isset($_SESSION['file_filename'][$id]))
{
header('HTTP/1.1 404 Not found');
exit(0);
}
if($cfg_soft_lang=='utf-8') $file_filename = $_SESSION['file_filename'][$id];
else $file_filename = iconv( 'UTF-8', 'gb2312//IGNORE' , $_SESSION['file_filename'][$id]);
echo $file_filename;
exit(0);
}
2、打开 /dede/album_add.php 找到
$imgfo = !empty(${'picfook'.$k}) ? ${'picfook'.$k} : '';
改成
$imgfo = !empty(${'picfook'.$k}) ? ${'picfook'.$k} : $_SESSION['file_filename'][$k];
3、打开 /dede/album_edit.php 找到
$imgfo = !empty(${'picfook'.$k}) ? ${'picfook'.$k} : '';
改成
$imgfo = !empty(${'picfook'.$k}) ? ${'picfook'.$k} : $_SESSION['file_filename'][$k];
4、打开 /dede/js/handlers.js 找到
newImgDiv.nerHTML += '<div style="marg-:10px">注释<put type="text" name="picfo'+albImg+'" value="" style="width:'+iptwidth+'px;" /></div>';
改成
newImgDiv.nerHTML += '<div style="marg-:10px">注释<put type="text" name="picfo'+albImg+'" value="" style="width:'+iptwidth+'px;" id="picput'+albImg+'" /><span id="picfo'+albImg+'" style="display:none;"></span></div>';
var picfo = document.getElementById('picfo'+albImg);
var picput = document.getElementById('picput'+albImg);
var myajax = new DedeAjax(picfo,false,false,"","","");
myajax.SendGet2('swfupload.php?dopost=thumbalt&id='+pid);
picput.value = picfo.nerHTML;
DedeXHTTP = null;
完成