Categories: 網頁設計

NEXTGEN GALLERY 檔名改為以時間記戳型式

將NEXTGEN GALLERY上傳檔案時,改以時間記戳如20140110160657 這樣當做檔名,

可以避免檔名原本是中文或是其他語系而造成Server找不到的亂碼!

修改 /admin/functios.php

找到

1.function upload_images() {
將裡面的
$filename = $filepart[‘basename’];
改為
//$filename = $filepart[‘basename’];
新增
$filename = date(“YmdHis”) .  ‘.’ . $filepart[‘extension’];

找到
$i = 0;
while ( in_array( $filename, $dirlist ) ) {
}
迴圈內容改為
$i = 0;
while ( in_array( $filename, $dirlist ) ) {
$filename = date(“YmdHis”) . ‘_’ . $i++ . ‘.’ . $filepart[‘extension’];
}

 

2. static function swfupload_image($galleryID = 0)

內容
將裡面的
$filename = $filepart[‘basename’];
改為
//$filename = $filepart[‘basename’];
新增
$filename = date(“YmdHis”) .  ‘.’ . $filepart[‘extension’];

找到
$i = 0;
while ( in_array( $filename, $dirlist ) ) {
}
迴圈內容改為
$i = 0;
while ( in_array( $filename, $dirlist ) ) {
$filename = date(“YmdHis”) . ‘_’ . $i++ . ‘.’ . $filepart[‘extension’];
}

完成。
========================================
NEXTGEN GALLERY file name to remember a time stamp type

The NEXTGEN GALLERY upload files, change the time stamp recorded as 20140110160657 such as file name,

Avoid file name was originally caused by Chinese or other languages ​​garbled Server not found!

Modify / admin / functios.php

Found

1.function upload_images () {
The inside of the
$ filename = $ filepart [‘basename’];
Instead
/ / $ filename = $ filepart [‘basename’];
New
$ filename = date (“YmdHis”)  .  ‘.’ .$ filepart [‘extension’];

Found
$ i = 0;
while (in_array ($ filename, $ dirlist)) {
}
Loop content to
$ i = 0;
while (in_array ($ filename, $ dirlist)) {
$ filename = date (“YmdHis”) ‘_’ $ i + + $ filepart [‘extension’]… ‘.’.;
}

 

2. Static function swfupload_image ($ galleryID = 0)

Content
The inside of the
$ filename = $ filepart [‘basename’];
Instead
/ / $ filename = $ filepart [‘basename’];
New
$ filename = date (“YmdHis”) .  ‘.’ . $ filepart [‘extension’];

Found
$ i = 0;
while (in_array ($ filename, $ dirlist)) {
}

Done! enjoy :)

yan

Share
Published by
yan