From 4b2cba4642df43250dcd9559367c41a85e9153e6 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 21 Jun 2012 09:11:26 +0100 Subject: [PATCH] bulk add uses tags from filename if filename is '123 - tag1 tag2 tag3.ext' folder name otherwise --- ext/bulk_add/main.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ext/bulk_add/main.php b/ext/bulk_add/main.php index 3f7cb250..376d1cb7 100644 --- a/ext/bulk_add/main.php +++ b/ext/bulk_add/main.php @@ -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 .= "
".html_escape("$shortpath (".str_replace(" ", ", ", $tags).")... "); try{ $this->add_image($fullpath, $pathinfo["basename"], $tags);