4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Chris on January 30, 2003, 05:11:55 AM

Title: [Mod] Add a keyword list to the search form v.2
Post by: Chris on January 30, 2003, 05:11:55 AM
Adds a list of all available image keywords to the search_form.html template where the user can select 1 or more and include those words in their search criteria.
See the screen shot at the bottom.

NOTE: There is some confusion circulating around what keywords really are in 4images. Let's see if I can help clear it up.

The default template search_form.html, with the english language pack, uses search_keywords and lang_search_keywords in the form field that actually accepts "words to search for". Search words can be anything from the image description, name, and even keywords. Keywords are words you explicitly assign to an image.

From a dictionary:
Quote
key·word also key word -
A word used as a reference point for finding other information.

It's very common for digital asset management software to not only let you categorize files, but to also let you assign keywords. Keywords are descriptive words, not phrases, that you can assign to your cataloged files in order to categorize and classify them. If you had an image of a tropical beach at sunset, you might assign it keywords such as Sand, Beach, Ocean, Sunset, Tropical, Vacation, Recreation, Outdoor, and so on. You might have chosen to place this image in a "Beaches" category. Suppose you also had an image of a city building taken at sunset when the color had changed and you placed it in a "Buildings" category. The keyword "sunset" could be used to group these images as having something in common. ("Tropical Sunset" is actually two keywords.)

Summary Description
The database table 4images_images is read and a sorted, unique list of keywords is generated. This array is then used to add list of all image keywords found to the search_form.html template. This is a standard HTML <select> form control that allows multiple items to be selected. Example is shown below:


Summary of files affected
[change] search.php
[change] includes/functions.php
[change] lang/english/main.php
[change] templates/default/search_form.html


Open search.php, locate this code near the top:
Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

Change it to the new lines as shown:
Code: [Select]
$org_search_keywords = $search_keywords;

// [Mod] Add a list of image keywords to the search form BEGIN
if (isset($HTTP_POST_VARS['search_keyword_list'])) {
  $search_keyword_list = implode(" ", $HTTP_POST_VARS['search_keyword_list']);
  $show_result = 1;
}
else {
  $search_keyword_list = "";
}

$org_search_keywords .= trim(" ".$search_keyword_list);
$search_keywords = $org_search_keywords;
// [Mod] Add a list of image keywords to the search form END

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {


Locate this code near the bottom:
Code: [Select]
    "category_dropdown" => get_category_dropdown($cat_id)
  ));

Change it to the new lines as shown:
Code: [Select]
    "category_dropdown" => get_category_dropdown($cat_id),
    "lang_image_keyword_list" => $lang['image_keyword_list'], // [Mod] Add a list of image keywords to the search form
    "image_keyword_list" => get_keyword_list() // [Mod] Add a list of image keywords to the search form
  ));



Open includes/functions.php, locate this code at the very bottom:
Code: [Select]
?>
Change it to the following:
Code: [Select]

// [Mod] Add a list of image keywords to the search form BEGIN
function get_keyword_list()
{
  global $lang, $site_sess, $site_db;
  $keyword_dropdown = "";
  $keyword_dropdown .= "<select name=\"search_keyword_list[]\" multiple=\"multiple\" size=\"10\" class=\"setperpageselect\">\n";
  $sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 order by `image_keywords` DESC";
  $result = $site_db->query($sql);
  $array = array();
  while(list($Name) = mysql_fetch_row($result)) {
// Commented out until enforcement of user/category/image permissions is developed
//    if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    if(!empty($Name)) {
      $explode_array = explode(" ",$Name);
      for($ctr=0; $ctr < count($explode_array); $ctr++){
        $temp = $explode_array[$ctr];
        $array[] = $temp;
      }
    }
  }
  $site_db->free_result();
  $array1 = array_unique($array); // Remove duplicate values from the array
  if (!empty($array1)) {
    sort($array1,SORT_REGULAR); // Sort the array
    foreach($array1 as $val) {
       $keyword_dropdown .= "<option value=\"".$val."\">".$val."</option>\n";
    }
  }
  $keyword_dropdown .= "</select>\n";
  return $keyword_dropdown;
}
// [Mod] Add a list of image keywords to the search form END

?>



Now let's correct some misleading text in the english language pack and add our new language phrases for this mod.

Open lang/english/main.php and locate:
Code: [Select]
$lang['search_by_keyword'] = "Search by Keyword:<br /><span class=\"smalltext\">Use terms such as AND, OR and NOT to control your search in more detail. Use asterisks (*) as a wildcard for partial matches.</span>";
$lang['search_terms'] = "Search term:";

Change those lines to:
Code: [Select]
$lang['search_by_keyword'] = "Search Words:<br /><span class=\"smalltext\">Use terms such as AND, OR and NOT to control your search in more detail.<br />Use asterisks (*) as a wildcard for partial matches.</span>";
$lang['search_terms'] = "Any or All search words?";


After this line
Code: [Select]
$lang['or'] = "OR";
Add this new line
Code: [Select]
$lang['image_keyword_list'] = "Select Image Keywords:<br /><span class=\"smalltext\">Use CTRL-click or SHIFT-click to select multiple keywords.<br><br>You can use the '".$lang['keywords_only']."' field above to limit your search.</span>"; // [Mod] Add a list of image keywords to the search form


Open templates/default/search_form.html and locate:
Code: [Select]
          <tr>
            <td class="row1">&nbsp;</td>
            <td class="row1"><input type="submit" value="{lang_search}" class="button" /></td>
          </tr>

Replace with this:
Code: [Select]
          <tr class="row2">
            <td valign="top"><b>{lang_image_keyword_list}</b></td>
            <td>{image_keyword_list}</td>
          </tr>
          <tr>
            <td class="row2">&nbsp;</td>
            <td class="row2"><input type="submit" value="{lang_search}" class="button" /></td>
          </tr>


Revisions:
Title: [Mod] Add a keyword jump menu to search form
Post by: V@no on January 31, 2003, 11:02:25 AM
I cant get this mod to work... :oops:
first off all, I think u post little extra code that gives error message.
Quote
Insert the following two new functions immediately above it (and under the get_category_dropdown function)
the bottom part of that insert already exist in 4images code:
Code: [Select]
function show_error_page($error_msg, $clickstream = "") {
  global $site_template, $site_sess, $lang, $config;
  if (empty($clickstream)) {
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].$lang['error'];
  }
  $site_template->register_vars(array(
    "error_msg" => $error_msg,
    "lang_error" => $lang['error'],
    "clickstream" => $clickstream,
    "random_image" => ""
  ));
  $site_template->print_template($site_template->parse_template("error"));
  exit;
}
so, php give error that function show_error_page() already registered.

but when I delete dublicate of this function, neither my search button, nor keyword sellect dont work at all, when I press either of them nothing happend... 8O
maybe I missed something?
Title: Sincerest appologies
Post by: Chris on February 01, 2003, 02:02:28 AM
I'm rather embarassed my original post didn't work.  I've got to stop making complex posts so late at night when I'm tired!

The original post has been updated.  You will notice a revision list at the bottom.  I prefer to edit the original post rather than post again since it keeps the instructions all in one place.  This time I tested my own instructions and code against a clean installation of 4images using the default template set.    Yes, it now works but be careful to follow ALL of the instructions.  I tweaked a couple of things.

Keep the feedback coming.  If there are any more problems, I will fix them straight away!
Title: [Mod] Add a keyword jump menu to search form
Post by: V@no on February 01, 2003, 02:36:50 AM
yay! now works in 3 min!
just now I realized that I dont even use keywords in the gallery...I have just 3 keywords for the whole collection  :?

Thx, vivdviews, nice MOD!
Title: [Mod] Add a keyword jump menu to search form
Post by: airphoto on February 01, 2003, 12:47:12 PM
Nice mod and I got it working in just a few minutes.

One small problem I would like to share. - The keyword jump menu and Keyword search links now show all keywords for all images in all catagories on the site.

When you click on a search link in the jump menu and it belongs to a private catagory the search engine returns "Your search resulted in no matching records." which can be a litle confusing.

Q. Can this be further modified to show only keywords from the catagories that members are allowed to view?

Hope this is good feedback.
Title: how about an "Add keyword" function?
Post by: jobro on February 02, 2003, 05:43:41 PM
Hi Jan, everybody,

I am impressed with the 4images script (if you can still call it a script?  :D ), and I have been searching for a way to integrate the function of adding keywords in a logical manner. I reply now and here, because i see the start if implementing such a function has just been started. My wishes are:

- At upload time, select keywords from the currently available ones in the database (from a drop down list or list box like shown in this thread) and add them to the picture being uploaded. This to prevent ambiguity between keywords that users might add at their own insight.

- Maybe it should be best if the admin adds his *fixed* list of keywords being the one to choose from when doing a search.

- In addition to that, the admin should be able to add keywords at any time.

- Important is, that when uploading masses of pictures, a fixed number of chosen keywords can be added to the pictures being uploaded automatically.

Could this all be possible to implement?

Good day to all and greetz from the Netherlands (snow outside!!  :lol:)

- Jobro
Title: Adding keyword dropdown to home page
Post by: jengwen on February 10, 2003, 04:00:53 AM
This is a great mod and worked fine on my search page.  I was hoping I could add a call to {keyword_dropdown_form} by the {category_dropdown_form} on my home and other similarily formatted pages.  However, when I add it, nothing happens.  There is no sign of the dropdown box, but I don't get any errors either.  Any thoughts on this?
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on February 10, 2003, 04:13:35 AM
It only works from the search form by design.  I deliberately avoided making it work like the category drop down where it would get called on every page hit.

Generating the keyword dropdown list is a costly operation since it has to read every image record from the database and parse through the array of keywords attached with each record.  If you have thousands of images this has the potential to really slow down a server as the number of concurrent visitors increases.  Remember that most people have their web sites on shared hosting solutions which means their box is probably already handling 150-400 other web sites too.
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on February 10, 2003, 04:22:13 AM
Quote from: airphoto
Nice mod and I got it working in just a few minutes.

When you click on a search link in the jump menu and it belongs to a private catagory the search engine returns "Your search resulted in no matching records." which can be a litle confusing.

Thanks.

I hear you on the private categories issue.  In my configuration of 4images it's not an issue since I don't use private categories.  And since I am very pressed for time over the next 4-6 week, I don't know when I will be able to re-examine this mod for an enhancement (fix)  :roll:

You are correct and I agree that the keyword list should be limited to keywords for which the user has access.

I'll try to see what I can come up with.  In the meantime if anyone else would care to lend their ideas on how it can be done, I'm all ears.
Title: [Mod] Add a keyword jump menu to search form
Post by: jengwen on February 10, 2003, 05:39:07 AM
I understand what you are saying about it being processor intensive to have on every page.  I am not sure this is a concern for me, since I won't have many users accessing my site and won't have that many photos.  If this is still a concern, I would be willing to cut-and-paste my list of keywords and hard-code them into the dropdown box.  They won't change often, so it wouldn't be hard for me to maintain.  Do you have an example of what I would need to change to get that to work?
Title: Keyword limit ?
Post by: intuitiv on February 10, 2003, 04:10:23 PM
Hello,

is it possible to limit the number of keywords listed in the dropdown?

thank you !
Title: Logical keyword add/search
Post by: jobro on February 10, 2003, 07:55:13 PM
Ever thought about categorising the keywords as well? I also thought of other methods of storing the keywords in a logical manner. I am running a modded test setup of 4images with 10 people that batch upload folders with their images at will.

They asked me for a different approach on the keywords which should rule out double entry or misspelled words so everyone searches with the right keywords. I thought of using only drop down menus for the keywords and an enhanced upload page which offers the opportunity to choose your keywords from the list that exists, thus preventing spelling mistakes etc. The admin can add or remove the keywords.

I think the given mod is a good start, but when the list of words gets too large, it doesn't work efficiently anymore. I am working on a modded batch import that does auto-thumbnailing as well as keyword addition, all in one go.

Who will help this poor PHP coder??  :oops:
Title: [Mod] Add a keyword jump menu to search form
Post by: tradertt on March 01, 2003, 08:41:37 PM
Is there anyway to limit the keywords? maybe to the more popular photos? or more  popular keywords? or a admin function to set it?
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on March 01, 2003, 09:36:16 PM
Sorry, there is no way to limit the number of keywords.

Sorry, there is no way to limit the keywords to only "popular" photos.

The purpose of my mod was to allow for easy keyword searches as part of the advanced search function.  Therefore, I did not design any limit mechanisms, nor do I have plans to do so since this is meant to be used as part of the advanced search feature.

The only change I am considering is to limit the keyword list to only those images which the user has permission to view.  This is a logical extension of the 4images user and group permissions security model and so it seems natural that it should be accomodated.  The problem with adding this is that I do not have time right now to take on the added work.

I'll post again if I have made any changes.
Title: Re: [Mod] Add a keyword jump menu to search form
Post by: Ernesto Taseffa on March 02, 2003, 12:33:33 AM
.
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on March 02, 2003, 06:08:05 AM
Sounds like you deleted it.  The screen shot was taken using the default, and therefore unmodified, search template.
Title: [Mod] Add a keyword jump menu to search form
Post by: tradertt on March 02, 2003, 06:32:53 AM
(http://Chris.com/hotlinks/4images.de/keyword_jump_menu.gif)

What will be the difference between keywords jump menu and keyword search link? How can I remove the Search Link if it is the same as the jump menu?

Do you think it could be sorted alphabetically? that is when you have time to do it of course :D
Title: [Mod] Add a keyword jump menu to search form
Post by: Ernesto Taseffa on March 02, 2003, 02:39:57 PM
.
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on March 02, 2003, 05:46:44 PM
Quote from: tradertt
What will be the difference between keywords jump menu and keyword search link? How can I remove the Search Link if it is the same as the jump menu?

Do you think it could be sorted alphabetically?

1. One is a drop-down jump menu, the other is a list of text links.
2. yes, they are the same.  If you don't want the text links, just don't put this line in your template
Code: [Select]
<td class="row1"><b>{lang_keyword_links}</b><br>{keyword_links}</td>
3. Try the mod.  The keywords are being sorted alphabetically. No change is needed.
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on March 02, 2003, 05:48:39 PM
Quote from: seffern
So there must been something changed in that template 4dark which is causing this. If someone can tell me where in the original files it is stored, I could try to copy it into the 4dark template...

Yep.  Those templates were originally designed for 4images 1.5.  You must go back to  the web site where you got that template. There you will find instructions in one of the forums on how to update the templates to work with 1.6 and 1.7.
Title: [Mod] Add a keyword jump menu to search form
Post by: tradertt on March 02, 2003, 06:21:59 PM
Quote from: Chris
Quote from: tradertt
What will be the difference between keywords jump menu and keyword search link? How can I remove the Search Link if it is the same as the jump menu?

Do you think it could be sorted alphabetically?

1. One is a drop-down jump menu, the other is a list of text links.
2. yes, they are the same.  If you don't want the text links, just don't put this line in your template
Code: [Select]
<td class="row1"><b>{lang_keyword_links}</b><br>{keyword_links}</td>
3. Try the mod.  The keywords are being sorted alphabetically. No change is needed.


Thanks man. I have installed it already but because I have not up my board thus unable to test. :D
Title: [Mod] Add a keyword jump menu to search form
Post by: tradertt on March 02, 2003, 06:50:38 PM
Is there any way I can put this DROP DOWN BOX in my main index.php page just beside the ADVANCE SEARCH button?
Title: [Mod] Add a keyword jump menu to search form
Post by: Ernesto Taseffa on March 02, 2003, 07:14:13 PM
.
Title: [Mod] Add a keyword jump menu to search form
Post by: tradertt on March 02, 2003, 07:16:56 PM
Quote from: seffern
o.k., here we are:

If you use template 4dark, you have to add the following code in the search_form.html of 4dark at the place you want it to appear:

<tr>
            <td valign="top" class="row2"><b>{lang_search_by_username}</b></td>
            <td class="row2" valign="top">
              <input type="text" name="search_user" size="40" value="{search_user}" class="input" />
            </td>
          </tr>


Dirk


Sorry is this post meant for me?
Title: [Mod] Add a keyword jump menu to search form
Post by: Ernesto Taseffa on March 02, 2003, 08:25:14 PM
.
Title: [Mod] Add a keyword jump menu to search form
Post by: Chris on March 02, 2003, 08:31:55 PM
Quote from: tradertt
Is there any way I can put this DROP DOWN BOX in my main index.php page just beside the ADVANCE SEARCH button?

Please read the rest of this thread.  This question has already been asked and I have already answered it.
Title: Re: [Mod] Add a keyword jump menu to search form
Post by: Vincent on May 07, 2005, 12:10:34 PM
is there a page out to have a look at?

sincerly
vincent
Title: Re: [Mod] Add a keyword jump menu to search form
Post by: Chris on May 07, 2005, 05:36:18 PM
No there isn't and I had actually completely rewritten this mod and published version 2.0 before the hacker deleted it.  Version 2.0 is way better than the original mod here.  It lets you select multiple keywords to search.

I simply haven't had time to restore that lost mod.  I will try to do it this weekend.

Here is a sneak peak at what the mod does:
Title: Re: [Mod] Add a keyword jump menu to search form
Post by: JensF on May 07, 2005, 08:42:37 PM
Quote
simply haven't had time to restore that lost mod.  I will try to do it this weekend.

I will wait for it :)
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Chris on May 08, 2005, 03:26:53 AM
FYI:

I have reposted version 2.0 of this mod. -  Enjoy !
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: JensF on May 08, 2005, 08:41:56 AM
Great, have have installed it and it works fine.....Thanks.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Vincent on September 08, 2005, 06:23:25 PM
up - maybe chris could help!

vincent
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: TIMT on October 16, 2005, 05:14:33 PM
Is it possible to modify the MOD, so that I can define somewhere (in a new file) the keywords I want have to be shown in the multi-item selectable list?
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: TIMT on October 19, 2005, 07:44:35 AM
I mean... instead to show all keywords in the database, in the list should be shown keywords, maintained in a new file. The file could be maintainded with an editor tool.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: TIMT on October 19, 2005, 03:42:56 PM
or I maintain the keywords direct in the HTML- or PHP-File.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Matthias70 on October 19, 2005, 04:46:58 PM
Is it possible to modify the MOD, so that I can define somewhere (in a new file) the keywords I want have to be shown in the multi-item selectable list?
I mean... instead to show all keywords in the database, in the list should be shown keywords, maintained in a new file. The file could be maintainded with an editor tool.
or I maintain the keywords direct in the HTML- or PHP-File

That would be a nice feature.
At the moment I have over 400 Words in the keywordsearchlist. That to much  :|
Matthias
Title: Re: [Mod] Add a keyword jump menu to search form
Post by: Buster on October 21, 2005, 09:13:36 AM
Sorry, there is no way to limit the number of keywords.

The only change I am considering is to limit the keyword list to only those images which the user has permission to view.  [..]
Hi Chris - a very nice and useful mod! When will you integrate this little but important limitation feature?
Gruß,
Reiner
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: TIMT on October 21, 2005, 09:22:05 AM
Hi Buster

would it be ok for you, if you can define somewhere specific keywords. And only this specific keywords would be shown (see posts above). With you, Mmathias70 an me, we would already be three people with this request. What do you mean?
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Vincent on October 21, 2005, 09:43:35 AM
Is it not possible to have this mod a bit modifieyed  

i would like to have it like this

A B C D E F G H I J K L M N O P .............. X Y Z
-------------------------------------------------------------------
- A -

Asien                  Armee                         Acrikultur
Armut                 arbeit                          Architektur
arbeitslos             arbeiter                       anatolien

usw usw
-----------------------------------------------------------------------

gruss
vincent
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Buster on October 21, 2005, 05:21:41 PM
Hi Buster

would it be ok for you, if you can define somewhere specific keywords. And only this specific keywords would be shown (see posts above). With you, Mmathias70 an me, we would already be three people with this request. What do you mean?
Hi Timt, just the other way round: All keywords except of those you don't want to be shown :)
Gruß,
Reiner
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: MaveriC on March 06, 2006, 05:08:16 AM
thanks for the mod!  :D :D you guys are gooooood!!  :D
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Vincent on March 06, 2006, 09:45:23 AM
I reask my question!  :wink:
Is it not possible to have this mod a bit modifieyed  

i would like to have it like this

A B C D E F G H I J K L M N O P .............. X Y Z
-------------------------------------------------------------------
- A -

Asien                  Armee                         Acrikultur
Armut                 arbeit                          Architektur
arbeitslos             arbeiter                       anatolien

usw usw
-----------------------------------------------------------------------

gruss
vincent
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: wallpapers on March 10, 2006, 07:02:59 PM
Great mod Chris :D
It works perfect  :lol:
thanks 8)
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: novw on March 21, 2006, 10:06:35 AM
huh ? in 4images 1.7.2 when I search for

Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

I turn up blank ? I can locate

Code: [Select]
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {

Somehow it does not feel the same ? Sounds like a great mod !
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Lukazs on April 22, 2006, 08:01:43 AM
i need that all keywords would be written in one line. Can some one do that? Please
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: BlueScorpion on May 23, 2007, 01:51:55 PM
@novw
I use version 1.7.4 and I paste the code before the IF-clause and it works fine, try it. :)

@MOD-Designer Chris ;)
Congratultions for this great MOD.

One fact, i tried to use the original searchfield and your keywords-list together.
one example: search field: "cars 2007" keywords-list: "blue"
The result was: "cars 2007blue"

I was looking for a fix and found this one:

Search in search.php
$org_search_keywords .= trim(" ".$search_keyword_list);

change to
$org_search_keywords .= " " . trim(" ".$search_keyword_list);

Good Luck
BluE

EDIT: Sorry but I find out that my "fix" disable the paging function in search results.
solution 1:
search: "if ($search_keywords != "" && $show_result == 1) {"
change to: "if ($search_keywords != "" && $search_keywords != " " && $show_result == 1) {"

solution 2:
search: "  $org_search_keywords .= " " . trim(" ".$search_keyword_list);
              $search_keywords = $org_search_keywords;"
move to the IF-clause so that the additional " " only paste in when keywords-list exists.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Buggy Driver on June 27, 2007, 12:54:39 PM
I installed this mod today.

Works like a charmed
Being my bad self I just needed to  change a few tings

Based on BlueScorpion post
http://www.4homepages.de/forum/index.php?topic=3850.msg93826#msg93826

look for
Code: [Select]
$org_search_keywords .= trim(" ".$search_keyword_list);
$search_keywords = $org_search_keywords;

change to  (solution 3:)
Code: [Select]
$org_search_keywords .= " ".$search_keyword_list;
$search_keywords = trim($org_search_keywords);

based on airphoto post
http://www.4homepages.de/forum/index.php?topic=3850.msg15953#msg15953

in functions.php  (4images 1.7.4)
look for
Code: [Select]
$sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 order by `image_keywords` DESC";

change in to
Code: [Select]
$sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 AND cat_id IN (".get_auth_cat_sql("auth_viewcat").") order by `image_keywords` DESC";

now the list show only keywords from the catagories that members/guests are allowed to view
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: BlueScorpion on June 28, 2007, 09:10:58 PM
I tried out the change posted by Buggy Driver to show only authenticated keywords,
in my case there is the word "geschenk" which is only a keyword in a category for registered users only, but after the change guests still get the keyword in the ajax-keyword-list.

where is the problem?
or did i missunderstand the function of this change?

greetings
bluE
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: Buggy Driver on June 28, 2007, 09:52:49 PM
I tried out the change posted by Buggy Driver to show only authenticated keywords,
in my case there is the word "geschenk" which is only a keyword in a category for registered users only, but after the change guests still get the keyword in the ajax-keyword-list.

where is the problem?
or did i missunderstand the function of this change?

greetings
bluE

if you choose that word do you get an images as a result?

The change just uses the existing   get_auth_cat_sql("auth_viewcat") function
The result of that function is a list of all categories that the current visitor has access to
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: BlueScorpion on June 28, 2007, 10:00:39 PM
no i don't get the images but this works without your change of sql-statement still before.

i thought the guest won't see the keywords of "user-images" only of "guest-images"?! or isn't it?
blue
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: BlueScorpion on June 29, 2007, 09:33:23 AM
Sorry,

it was my mistake.
I thought this change has a bearing on my ajax-search-input-field too, but it's only for the keywordlist (title of this thread) ;)

Sry for that and thanks for help.

BluE
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: getcom on September 06, 2007, 04:41:41 PM
Great mod, but can this be changed so you could have more than one dropdown list say like a dropdown list for colour and one for shape and one for 3d or not. so the search would then do a search for say the colour red+AND+square+AND+3d. this way they could have 3 choices to choose from or use all three.

Would be great if could be done

Many thanks
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: myr2904 on January 20, 2008, 01:03:19 AM
Is it possible to have this mod like this?


Is it not possible to have this mod a bit modifieyed 

i would like to have it like this

A B C D E F G H I J K L M N O P .............. X Y Z
-------------------------------------------------------------------
- A -

Asien                  Armee                         Acrikultur
Armut                 arbeit                          Architektur
arbeitslos             arbeiter                       anatolien

usw usw
-----------------------------------------------------------------------

gruss
vincent
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: shadowhunter on June 06, 2008, 06:13:00 PM
Hallo!
Ich habe noch 2 Probleme bei diesem Mod gefunden und behoben betreffend der Sortierung:

Vorher:
Quote
Aab
(...)
blablabla
(...)
Zzz
aaa
Äaa


Nachher mit neuem Code:
Quote
Aaa
Aab
Aeaa
(...)
blablabla
(...)
Zzz


Suche in includes/functions.php:
Code: [Select]
$array[] = $temp;
Ersetze durch:
Code: [Select]
$temp = strtr($temp, array("Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue","ä" => "ae", "ö" => "oe", "ü" => "ue"));
        $array[] = ucfirst($temp);

Behobene Probleme bei der Sortierung:
Umlaute & wenn 1. Buchstabe klein ist.

Gruss Jones
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: alekinna on September 05, 2008, 04:41:52 PM
I did little modification, based on this mod, that add keyword list to admin panel (textarea, not dropdown form).But first:
1. It will add keyword list only to form "check new images"
2. I'm not a programmer and perhaps it is no correct way to do this, but it work for me.

Open includes/functions.php, locate this code at the very bottom:
Code: [Select]
?>
Change it to the following:
Code: [Select]
// --------------- Add a list of keywords to the admin form "check new images" BEGIN -------------------------------
function get_keyword_list_admin() {
  global $lang, $site_sess, $site_db;
  $keyword_dropdown = "";
  $keyword_dropdown .= "<textarea name=\"search_keyword_list[]\" cols=\"30\" rows=\"8\" class=\"setperpageselect\">\n";
  $sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 order by `image_keywords` DESC";
  $result = $site_db->query($sql);
  $array = array();
  while(list($Name) = mysql_fetch_row($result)) {
// Commented out until enforcement of user/category/image permissions is developed
//    if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    if(!empty($Name)) {
      $explode_array = explode(" ",$Name);
      for($ctr=0; $ctr < count($explode_array); $ctr++){
        $temp = $explode_array[$ctr];
        $array[] = $temp;
      }
    }
  }
  $site_db->free_result();
  $array1 = array_unique($array); // Remove duplicate values from the array
  if (!empty($array1)) {
    natcasesort($array1); // Sort the array by A-Z, case insensitive
    foreach($array1 as $val) {
       $keyword_dropdown .= $val."\n";
    }
  }
  $keyword_dropdown .= "</textarea>\n";
  return $keyword_dropdown;
}
//----------------------------- Add a list of keywords to the admin form "check new images" END ---------------------------

?>

Open admin/checkimages.php, locate this code:
Code: [Select]
$title = $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src, "keyword", "image_keywords_".$ii) : "");
Change it to the following:
Code: [Select]
$title = $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src, "keyword", "image_keywords_".$ii) : "")."<br />".get_keyword_list_admin();
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: AntiNSA2 on June 04, 2009, 11:37:28 AM
Greetings , Im using 1.76 and in step one it says to find this
Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

however  I have a different code in mine:
Code: [Select]
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
I would love to use this mod if someone can make it work for 1.7.6
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: dp on November 30, 2009, 12:46:59 PM
Greetings , Im using 1.76 and in step one it says to find this
Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

however  I have a different code in mine:
Code: [Select]
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
I would love to use this mod if someone can make it work for 1.7.6

I'm running this Mod succesfully with v 1.7.7.
Don't mind about the diffenrent code you pointed out. Just place the mod's code after it.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: dp on January 09, 2010, 06:57:51 PM
This Mod works fine up to 5700 Images and nearly 800 keywords in my database. But when I add some more pictures, the function get_keyword_list() in functions.php exceeds the memory limit of 32 M of my server and the searchform could not be displayed anymore.

Responsible was this line

 
Code: [Select]
$array1 = array_unique($array); // Remove duplicate values from the array
This line is essential, of course. So imho this mod is for small galleries only.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: surferboy on April 22, 2010, 07:19:01 AM
Hey DP,

Just read your post. Was thinking about adding this MOD. We anticipate our community having upwards of 10,000 - 15,000 images within a couple of years BUT the keywords will be around 70 -90.

Do you think the server memory limits of 32MB would operate properly with these fewer keywords? In other words, my question is what tips the scales, the number of keywords or the total number of images?

Thanks for any advice you can give.

Brian
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: dp on May 18, 2010, 02:02:36 PM
Hey DP,

Just read your post. Was thinking about adding this MOD. We anticipate our community having upwards of 10,000 - 15,000 images within a couple of years BUT the keywords will be around 70 -90.

Do you think the server memory limits of 32MB would operate properly with these fewer keywords? In other words, my question is what tips the scales, the number of keywords or the total number of images?

Thanks for any advice you can give.

Brian

Hi Brian,

sorry for the delay.
My server is running with 32M, so there is no different to your environment. The memory limit exceeds by the function which erases keyword duplicates. This can be caused by both, number of images and number of keywords per image, imho. In your case I would give it a trial, it's not much work at all. If you try, post your experience here, please.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: nameless on September 02, 2010, 09:28:03 PM
i need help
i have a problem after i use 4image 1.7.8

after i use migrate keywords to change the space to , its ok but it make problem with this mod have a look

http://www.arabmobile.mobi/c/cell/search.php

please wait until the page open
Title: Re: problem in the search after useing 1.7.8
Post by: V@no on September 04, 2010, 04:48:13 PM
What mod?
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: nameless on September 06, 2010, 12:26:55 AM
thanks v@no

this mod
[Mod] Add a keyword list to the search form v.2
http://www.4homepages.de/forum/index.php?topic=3850

you can see 1.7.8 need , to Separates between keywords and this mod need space to Separates between keywords

see what happen here

http://www.arabmobile.mobi/c/cell/search.htm
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: V@no on September 06, 2010, 02:02:30 AM
in search.php replace
  $search_keyword_list = implode(" ", $HTTP_POST_VARS['search_keyword_list']);

With this:
  $search_keyword_list = implode(",", $HTTP_POST_VARS['search_keyword_list']);

I think this should be enough.
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: nameless on September 06, 2010, 09:40:55 PM
thanks thanks V@no

i make it but i have to replace another one in  includes/functions.php

$explode_array = explode(" ",$Name);

replace with this

$explode_array = explode(",",$Name);

thank you againe V@no for all your help
Title: Re: [Mod] Add a keyword list to the search form v.2
Post by: nameless on May 19, 2011, 06:50:01 PM
hi every one

i upgrade to 4image 1.7.10

and this mod is very important for me
I have a mobile site
so it help user when they search for a mobile with some Special specifications

it was work before now

when i  Choose 1 keywords ok it work and gave me Results
but when i choose 2 or more keywords using ctrl key it does't work and gave me no Results

for example
when i choose 2011 and camera
it be like this camera,2011 and no results
i thinlk it must me camera and 2011