Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - SunnyUK

Pages: [1]
1
Hi all,

I have had a browse and done some searches, but have not been able to find a solution, so I'm hoping that someone here might know....

I would like to know how people use the "search" function on my 4images website. If I were to create a mod for it, I would break it into three separate activities

1) log all search criteria
2) analyse the content of that log
3) display the results of the analysis

Does anyone know of an existing mod that will do some or all of this?

Thanks in advance for any help or pointers.

2
Discussion & Troubleshooting / What is $show_result used for?
« on: July 19, 2008, 04:16:28 PM »
I'm trying to create an advanced search function (enabling the user to search by multiple fields... e.g. "show me the pictures taken with my macro lens during summer where fill flash was used"), so I'm amending search.php.

It seems that most of the existing functionality in search.php is controlled by a variable called $show_result. This variable gets set in global.php.

Can I safely add code similar to this to global.php or will that cause troubles in the way 4images works ?

Code: [Select]
if (isset($HTTP_POST_VARS['search_date']) || isset($HTTP_GET_VARS['search_date'])) {
  $search_date = (isset($HTTP_POST_VARS['search_date'])) ? trim($HTTP_POST_VARS['search_date']) : trim($HTTP_GET_VARS['search_date']);
  if ($search_date != "") {
    $show_result = 1;
  }
}
else {
  $search_date = "";
}

The code snippet is a slight tweak to the existing code for search_user in global.php

Thanks in advance for any guidance.

3
I installed the "alternate directory for download files" mod (http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712) and got it working. So now for each image I typically have

\data\media\<category>\picture.jpg
\data\media\<category>\download\picture.jpg
\data\thumbnails\<category>\picture.jpg

When I delete an image (from the detail screen), the \data\media\<category>\download\picture.jpg is not deleted.

How can I tweak the system so that it does get deleted together with the two other files?

Any assistance would be greatly appreciated!

Thanks in advance,
Tomas

4
Is there a way I can re-upload an image without having it processed as a new picture? Basically I would like to be able to amend the picture (say, add more IPTC information) and upload (via FTP) to my 4images album without either a) the existing comments/ratings disappearing and without b) the picture being marked as "new".

Any assistance would be greatly appreciated.

5
Mods & Plugins (Requests & Discussions) / Multi-word keywords
« on: May 31, 2008, 12:43:33 AM »
First of all, I am not a php programmer. In fact today was the first time I ever tried to write a single php statement. So beware that what follows might be utter rubish! ;)

Having said that, I wanted to be able to handle keywords which consists of several individual words. Out-of-the-box 4images would treat the keyword <Summer evening> as two separate words. In English where a lot of phrases are made up of individual words without a dash or anything in between, this feels awkward.

I have spent hours scanning the forum, and it seems that others have asked for this without it being resolved.

My solution builds upon Rembrandt's IPTC V.1.7.6 Suchfelder erweiterung mod: http://www.4homepages.de/forum/index.php?topic=21141.0
Do not attempt this mini-mod-attempt without first having applied Rembrand's mod.

Here goes

a) The idea is to convert spaces to underscores when keywords come into the system and convert underscores back to spaces when keywords are displayed (the keywords table strip underscores away, so a keyword <Summer_Evening> will be stored there as <SummerEvening> which is pretty perfect as it prevents hits if people search for <Summer>).
b) keywords can come into the system from IPTC tags (which corresponds to the tags displayed by e.g. Vista or Photoshop) - see edit 2) below
c) keywords can be entered directly on the "edit image" form in the APC. I don't know how to intercept that... if anyone has an idea, please shout!
d) keywords are shown on the detail screen as clickable hyperlinks - see edit 1) below

1) Edit includes\functions.php.

Find

Code: [Select]
  if (!empty($image_row['image_keywords'])) {
    $split_keywords = explode(" ", $image_row['image_keywords']);
    $keywords = "";
    foreach ($split_keywords as $key => $val) {
        $keywords .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".urlencode($val))."\">".format_text($val, 2)."</a>";
    }

Replace by

Code: [Select]
  if (!empty($image_row['image_keywords'])) {
    $split_keywords = explode(" ", $image_row['image_keywords']);
    $keywords = "";
    foreach ($split_keywords as $key => $val) {
        $oldval = $val;
        if ($val != "") {
        $val = str_replace('_', ' ', $val);
}
        $keywords .= (($keywords != "" ) ? ", " : "")."<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".urlencode($oldval))."\">".format_text($val, 2)."</a>";
    }

2) Edit \admin\checkimages.php

Find

Code: [Select]
  $iptc_keywords_default = 0; //auto insert keyword from IPTC (0 or 1)

Replace with
Code: [Select]
  $iptc_keywords_default = 1; //auto insert keyword from IPTC (0 or 1)

Find

Code: [Select]
                $caption = ($iptc_description && isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";
                $keywords = "";
                if ($iptc_keywords && isset($iptc['2#025']))
                {
                  foreach ($iptc['2#025'] as $val)
                  {
                    $keywords .= (($keywords != "" ) ? " " : "").$val;
                  }

Replace with

Code: [Select]
                $caption = ($iptc_description && isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";
                $keywords = "";
                if ($iptc_keywords && isset($iptc['2#025']))
                {
                  foreach ($iptc['2#025'] as $val)
                  {
                    $val = str_replace(' ', '_', $val);
                    $keywords .= (($keywords != "" ) ? " " : "").$val;
                  }

3) This works if you get your pictures into the database by
a) FTP'ing the images to your site
b) running a "check images" from the APC

4) This also works if you type in keywords with underscores in place. So say you wanted to type in the tag <Summer Evening>, you would type it in as <Summer_Evening>. I have not been able figure out how to get checkimage.php to automatically replace <Summer Evening> with <Summer_Evening> for you, so unless someone can point me in the right direction (?), I can't help here. As I aim to have my images tagged before upload, it's not a huge problem for me, but it would be nice to find a solution.

As I started by saying, this is my first attempt at modifying 4images or anything else in php. It is entirely possible that this "mod" will break something or that there are side effects which I haven't considered. So use it at your own peril. Having said that, if you do use it, please let me know if it also works acceptable for you or if you run into problems.

Pages: [1]