Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Feature Request: keywords with embedded spaces  (Read 4209 times)

0 Members and 1 Guest are viewing this topic.

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Feature Request: keywords with embedded spaces
« on: September 25, 2006, 08:46:30 pm »

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).
« Last Edit: September 25, 2006, 10:32:13 pm by wprowe »
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Feature Request: keywords with embedded spaces
« Reply #1 on: September 25, 2006, 10:03:21 pm »

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.
« Last Edit: September 25, 2006, 10:32:31 pm by wprowe »
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Aeronautic

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 125
  • Photographer / film maker turned webmeister...
Re: Feature Request: keywords with embedded spaces
« Reply #2 on: September 26, 2006, 03:26:59 pm »

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:

Quote
You 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...
Logged

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Feature Request: keywords with embedded spaces
« Reply #3 on: September 26, 2006, 09:48:49 pm »

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.
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography

Nibbler

  • Guest
Re: Feature Request: keywords with embedded spaces
« Reply #4 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?
Logged

wprowe

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 32
    • Music, Travel, Outdoor, Nature and Wildlife Photography
Re: Feature Request: keywords with embedded spaces
« Reply #5 on: September 27, 2006, 03:49:10 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).
Logged
Walter Rowe
Music, Travel, Outdoor, Nature and Wildlife Photography
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.