Feature Request: keywords with embedded spaces Feature Request: keywords with embedded spaces
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Feature Request: keywords with embedded spaces

Started by wprowe, September 25, 2006, 08:46:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wprowe

CPG does not properly handle keywords with embedded spaces. Suppose I have a keyword "Sugar Maple" to identify a kind of tree. CPG turns that into "Sugar" and "Maple" - two keywords instead of one. The problem manifests itself in the keyword search feature in the detailed image info form. Instead of "Suger Maple" showing up as a single search link, "sugar" and "maple" are displayed as separate search links - each link searching only for the individual word "sugar" or "maple" respectively.

Other examples where spaces will be embedded in keywords are band names (Van Halen, Def Leppard, Goo Goo Dolls, The Who, Grateful Dead), names and titles (Wolfgang Amadeus Mozart, Prime Minister, Vice President), landmarks (Grand Canyon, Eiffel Tower, Big Ben, Machu Picchu), country/ state names and continents (South Korea, North Dakota, South America, East Timor), etc. As you can see, this is a serious problem for stock photographers like me. We need a reliable search engine where our clients can search our image gallery and accurately find things.

The keywords are properly stored in the original image files and correctly extracted into the initial iptc array in includes/iptc.inc.php. Later calls to implode in include/picmgmt.inc.php and upload.php before storing in the pictures table use a space as the glue string to flatten out the keywords array into a varchar string. This is where the problem gets introduced. From there on, it is impossible to determine which spaces were originally embedded in keywords and which were used as glue strings. I suggest using a semi-colon as the glue string. Many programs use it as a delimiter when entering multiple keywords. I'm sure code will have to be changed in numerous places to correct this problem and support using the semi-colon delimiter (and creating proper search links in the detailed image info form).
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

wprowe

#1
I figured out a pattern for preg_replace() in displayimage.php to properly parse using a semi-colon delimiter for keywords. The pattern should be /([^;]+)/, which matches one or more of anything but a semi-colon. This allows commas to be embedded in keywords just in case someone wanted to use it - for example "Washington, DC", "Dr. Neil Clark Warren, Ph.D" or "Dale Earnhardt, Jr" are valid keywords with commas in them.
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Aeronautic

Hi, this is addressed in the docs, at least the two word underscore issue.

Try here: http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#album_prop

For this:

QuoteYou simply upload a file to one album as you would normally do, then assign one or more keywords to the file. The keyword function reads blank spaces between words as a 'break' and assumes that these words are separate words. If you must use phrases for your keywords, connect them with an underscore or by using the ascii space holder ctrl+Alt+0160 (NOTE: the latter option only works with latin based character sets.)

Hope that is helpful...

wprowe

Thanks for the reply. Unfortunately, this is not a good solution. Stock photo and news agencies; image catalog tools like iView Media Pro, ThumbsPlus, iMatch, and Adobe Bridge; etc. can all properly parse the keywords with embedded spaces. Coppermine is the utility that is incompatible with all the rest. Coppermine should work like all the other tools in the industry. It is unreasonable to expect someone to change the keywords in their entire image collection just to suit Coppermine's incompatibility. It is far simpler to modify Coppermine to work like all the other industry tools.

I have been studying this some more. It appears there are maybe half a dozen files that need modifying in order to change this behavior in Coppermine, but I am not an expert in the Coppermine code so I could be very wrong. It would be nice of someone from the development team to look into this and comment on the level of effort that would be required to change this behavior.
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Nibbler

How would adding this as a feature affect existing users? Would we need to convert their existing space delimited keywords to this new system?

wprowe

Quote from: Nibbler on September 26, 2006, 10:04:03 PM
How would adding this as a feature affect existing users? Would we need to convert their existing space delimited keywords to this new system?

Existing picture keyword data in the picture table would have to be regenerated from the original files. If people properly apply metadata to their image files, this should be relatively painless since the current version of Coppermine lets you perform admin tasks on the entire gallery (all albums) in a single pass. Under the Admin Tools page, there should be a section added for reloading the IPTC and EXIF data (provided those are enabled in the configuration menu).
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography