[
2004/09/06 12:42 | by turbozv ]
2004/09/06 12:42 | by turbozv ]
原来相册的文件名排序上有BUG,查找代码,在include/gallery_classes.php文件的114行代码:
查询php的手册:
在include/gallery.php文件中,图片全部按$img下标来操作的,所以natsort完全没用。
修改很简单,把两个natsort替换成sort即可
natsort($this->thumb);
natsort($this->sub);
natsort($this->sub);
查询php的手册:
natsort -- 用“自然排序”算法对数组排序
说明
void natsort ( array array)
本函数实现了一个和人们通常对字母数字字符串进行排序的方法一样的排序算法,这被称为“自然排序”。
说明
void natsort ( array array)
本函数实现了一个和人们通常对字母数字字符串进行排序的方法一样的排序算法,这被称为“自然排序”。
sort -- 对数组排序
说明
void sort ( array array , int sort_flags)
本函数对数组进行排序。当本函数结束时数组单元将被从最低到最高重新安排。
说明
void sort ( array array , int sort_flags)
本函数对数组进行排序。当本函数结束时数组单元将被从最低到最高重新安排。
在include/gallery.php文件中,图片全部按$img下标来操作的,所以natsort完全没用。
修改很简单,把两个natsort替换成sort即可
[
2004/09/05 23:31 | by turbozv ]
2004/09/05 23:31 | by turbozv ]
很简单的修改
$img_file_name = $gallery->dir.$gallery->thumb[$i].".txt";
$handle = fopen ($img_file_name, "r");
if ($handle) {
$desc_contents = fread ($handle, filesize ($img_file_name));
fclose ($handle);
} else {
$desc_contents = "no_desc";
}
$image = new image($gallery->get_image($i));
$template->set_params(array("gal" => $gal, "img" => $i,
"img_path" => $gallery->dir.$gallery->thumb[$i],
"img_name" => $image->name, "img_width" => $image->width,
"img_desc" => $desc_contents, // added by ZV for pic_desc 2004.9
"img_height" => $image->height, "img_size" => $image->size));
$img_file_name = $gallery->dir.$gallery->thumb[$i].".txt";
$handle = fopen ($img_file_name, "r");
if ($handle) {
$desc_contents = fread ($handle, filesize ($img_file_name));
fclose ($handle);
} else {
$desc_contents = "no_desc";
}
$image = new image($gallery->get_image($i));
$template->set_params(array("gal" => $gal, "img" => $i,
"img_path" => $gallery->dir.$gallery->thumb[$i],
"img_name" => $image->name, "img_width" => $image->width,
"img_desc" => $desc_contents, // added by ZV for pic_desc 2004.9
"img_height" => $image->height, "img_size" => $image->size));
[
2004/09/05 16:00 | by turbozv ]
2004/09/05 16:00 | by turbozv ]
















