PDA

View Full Version : Long file name keywords


skidpics
November 11th, 2008, 06:10 PM
If I have a filename such as: ENDANGERED_PEREGRINE_FALCON_Falco_peregrinus_WITH_PARTRIDGE_PREY_EUROPE

How can I get it to make the keywords without the _ attaching the words, so instead, make the entire filename split the words to:

ENDANGERED PEREGRINE FALCON Falco peregrinus WITH PARTRIDGE PREY EUROPE

Chuck S
November 11th, 2008, 06:20 PM
well you would need to actually enter the keywords. We only use a title on showphoto if keywords are empty.

skidpics
November 11th, 2008, 06:23 PM
correct, but can we not put a preg_replace or something to get rid of the underscore?

There should be an admin setting for banned characters, which would remove such characters and replace them with a space.

Either way, can that not be done before the keyword based on the filename is generated?

skidpics
November 11th, 2008, 06:55 PM
After digging around, I found the answer in one of my previous posts concerning something else..however, the syntax express was wrong..

Find in showphoto.php:

if ( empty($keywords) )


Add above:
// preg_replace below strip out any punctuation and spaces from title, replacing such characters with spaces for better keywords
$title = preg_replace("/[^0-9A-Za-z]/", " ", $title);

this will strip out any symbol (not a number or a letter), and convert it to a space..

Now, how do we get the filename to be added to the keywords one may enter as additional to the keyword listing? I need some sort of function to add the $title to the $keywords to equal the new $keys?

Chuck S
November 11th, 2008, 09:04 PM
On showphoto as posted the title is used if there are no keywords otherwise you need to enter keywords on upload.

You can use something similar on image-inc.php has for keywords to be a filename?


if ( empty($title) )
{
$title = $filenoext;
}

if ( empty($keywords) )
{
$keywords = $filenoext;
}