deepsea887 / sigplus

Automatically exported from code.google.com/p/sigplus
0 stars 0 forks source link

Filtering images based on keywords #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Assume new topic is resolved because the previous but in a different way.
http://code.google.com/p/sigplus/issues/detail?id=25&can=1&q=include

I would like to accomplish this task:

1. find the specified directory all files whose names contain the phrase "* 
city_ *" and "* _night_ *" and "* _budapest_ *"
2. remove from the list of files that have the phrase in the name of "* _bath_ 
*" or "* _folks_ *"

3. Create a gallery. 

{gallery name-include="*city_*" AND "*_night_*" AND "*_budapest_*" 
name-exclude="*_bath_*" OR "*_folks_*"  preview_height=80 
alignment="center"}sigplus/sample/{/gallery}

OR

Quickly create a gallery of limiting certain expressions in the file name or 
description label.txt

{gallery filter-exclude="*_landscape_*;*.png;*_night_*"}city/*_Spain_*{/gallery}

Reagrds!

Original issue reported on code.google.com by ten.mari...@gmail.com on 18 Oct 2012 at 8:37

GoogleCodeExporter commented 9 years ago
I may misunderstand your intent but it seems the requested functionality is 
already available in the latest sigplus version. As an illustration, the wiki 
documentation for filters uses the following example:

{gallery filter-include="owl_*;*_portrait_*" 
filter-exclude="*.png"}animals{/gallery}

This shows images with a file name that starts with the characters owl_, or 
includes the text _portrait_ in any part of the file name, but omits PNG files. 
In other words, the set of all images in the directory is first narrowed to the 
those that meet the include filter, and then these are further pruned to remove 
those items that satisfy the exclude filter. In other words,

{gallery filter-exclude="*_landscape_*;*.png;*_night_*"}city/*_Spain_*{/gallery}

should be typed as

{gallery filter-include="*_Spain_*" 
filter-exclude="*_landscape_*;*.png;*_night_*"}city{/gallery}

and should give the expected results.

Original comment by huny...@gmail.com on 27 Oct 2012 at 10:01

GoogleCodeExporter commented 9 years ago
Prior to sigplus 1.5.0.169, "filter-include" and "filter-exclude" were not 
supported when the image source was a wildcard expression (containing an "*" or 
a "?"). In sigplus 1.5.0.169, the wildcard image source is treated as an 
implicit include filter, and appended to the (possibly empty) list declared by 
"filter-include". The relationship between elements of "filter-include" remains 
an AND relationship.

Complex expressions that involve an arbitrary combination of both AND and OR 
relationships remain unsupported. The syntax proposed in the issue report

name-include="*city_*" AND "*_night_*" AND "*_budapest_*" 
name-exclude="*_bath_*" OR "*_folks_*"

would (unfortunately) violate the parameter=value or parameter="value" syntax 
currently supported in sigplus. Moreover, the cases outlined as examples to 
necessitate the complex syntax can all be expressed in the current, much 
simpler syntax. (Please add a comment to the discussion if this is not so.)

Original comment by huny...@gmail.com on 31 Oct 2012 at 3:27

GoogleCodeExporter commented 9 years ago
Please note that what you propose is good but it has a major drawback.

name-include="*city_*" AND "*_night_*" AND "*_budapest_*" 
name-exclude="*_bath_*" OR "*_folks_*"

Gallery built in this way will contain not only photos I needed, "Budapest", 
but also all the images of "night" and "City".

How do I describe the code SigPlus gallery to build only the "Budapest" but 
containing the word "night" and the "city"?

Original comment by ten.mari...@gmail.com on 2 Nov 2012 at 8:11

GoogleCodeExporter commented 9 years ago
Mea culpa. In one of the comments above I write (incorrectly) that phrases in a 
filter expression (separated by a semicolon) are combined in an AND 
relationship whereas the documentation states (correctly) that they are 
combined in an OR relationship. With this correction, your concerns are 
completely valid: it is not currently possible to express an AND combination of 
phrases. I will look into ways how this can be incorporated into the filter 
expression syntax.

Unfortunately, your syntax proposal is not feasible because it violates the 
"name=value" syntax all sigplus parameters must adhere to, there cannot be a 
word "AND" or "OR" in between the parameters, as shown above. A possible 
candidate for denoting an AND relationship would be the comma:

{gallery filter-include="*city_*,*_night_*,*_budapest_*" 
filter-exclude="*_bath_*;*_folks_*"}city{/gallery}

The comma (AND) would have higher precedence than the semicolon (OR).

Original comment by huny...@gmail.com on 2 Nov 2012 at 9:47

GoogleCodeExporter commented 9 years ago
sigplus version 1.5.0.170 and later supports compound expressions in both 
include and exclude filters. Compound expressions use comma (,) as a 
conjunction ("and") and semicolon (;) as a disjunction (;), the conjunction has 
higher precedence. The activation code

{gallery filter-include="*city_*,*_night_*,*_budapest_*;*_krakow_*" 
filter-exclude="*_bath_*;*_folks_*"}city/*.jpg{/gallery}

therefore selects all files that satisfy the expression

*.jpg AND ((*city_* AND *_night_* AND *_budapest_*) OR *_krakow_*) AND NOT 
(*_bath_* OR *_folks_*)

Original comment by huny...@gmail.com on 3 Nov 2012 at 9:14

GoogleCodeExporter commented 9 years ago
big thanks.
Is  works the filter-include works without the filter-exclude?

ex:
{gallery filter-include="*city_*,*_night_*,*_budapest_*;*_krakow_*" 
}city/*.jpg{/gallery}

Regards!

Original comment by ten.mari...@gmail.com on 26 Nov 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Yes, both "filter-include" and "filter-exclude" are optional.

Original comment by huny...@gmail.com on 26 Nov 2012 at 3:05

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm sorry, it works well. This is a great tool for rapid construction gallery. 
Congratulations!

Original comment by ten.mari...@gmail.com on 4 Dec 2012 at 9:41