bulk add uses tags from filename if filename is '123 - tag1 tag2 tag3.ext' folder name otherwise

This commit is contained in:
Shish 2012-06-21 09:11:26 +01:00
parent e7df4edbee
commit 4b2cba4642

View file

@ -87,10 +87,16 @@ class BulkAdd extends Extension {
}
else {
$pathinfo = pathinfo($fullpath);
$tags = $subdir;
$tags = str_replace("/", " ", $tags);
$tags = str_replace("__", " ", $tags);
$tags = trim($tags);
$matches = array();
if(preg_match("/\d+ - (.*)\.([a-zA-Z]+)/", $pathinfo["basename"], $matches)) {
$tags = $matches[1];
}
else {
$tags = $subdir;
$tags = str_replace("/", " ", $tags);
$tags = str_replace("__", " ", $tags);
$tags = trim($tags);
}
$list .= "<br>".html_escape("$shortpath (".str_replace(" ", ", ", $tags).")... ");
try{
$this->add_image($fullpath, $pathinfo["basename"], $tags);