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 - jengwen

Pages: [1]
1
I have installed quite a few mods.  I am now running into a problem where my home page takes awhile to load, so the user just sees a blank white screen for a few seconds.  I am thinking about removing some of the mods, but would prefer not to get rid of all the code, so I could put them back easily.  My question is when does the code get called?  If I remove the {field} from the html pages, does all the code to get that field stop getting called?  Or, does it all get called regardless of if you display the field or not?  The answer is probably somewhere in between, but any insights would be appreciated.

2
I have alot of images that are similar to each other.  I have over 700 images in my animal category, so browsing the thumbnails is getting cumbersome.  I am thinking of leaving just the best few out there of each animal and making the rest inactive.

However, I would like the 'More like this' mod I created to find both active and inactive images.  That way, if someone is interested in a particular type of image, but isn't seeing the angle or cropping they prefer, I could show them more choices.

Are the inactive images in all the databases and search indexes?  I am thinking there might just be a check in the thumbnail displays that makes sure it is active.  If this is the case, I could just tweak that code to display inactive images in certain cases.  I am the only one who can add images, so I don't have to worry about any images being inactive out there that I don't know about.

My other thought was to put them all in a special folder that I hard-code to hide on the main categories page.  My only concern with this is that it might be confusing when they show up after a search with a category name that isn't seen anywhere else or with no category name if I hard-code it to work that way.  

Any input or suggestions would be appreciated.

3
On several occasions I have had to delete all my images and re-add them through the admin panel.  Mainly, this is because I have updated most of the descriptions or keywords, or saved the images at a different Jpeg quality or size and FTP'd them to the folders again.  The only problem with this is that the ratings, comments, etc., get deleted as well.  

It would be great if someone could come up with a mod for the admin control panel where you could choose to update image fields.  It would only have to update fields that can be defaulted from iptc data (like checkimages) and possibly any image size fields if those are stored anywhere.  If easier, maybe this could be a plug-in that you would need to customize like the batch upload.

4
Some of my additional image fields are dates and I have had to go into details.php and checkimages.php and hard code my field names in with different formatting.  It would be nice if this was a type you could assign in db_field_definitions.php and admin_functions.php, etc.,  would incorporate it.

5
This mod will show the thumbnail before the image name in the control panel edit images list used for deleting or editting images.

File to change is admin/images.php

find:
Code: [Select]
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
            WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id
            ORDER BY $orderby $direction
            LIMIT $limitstart, $limitnumber";
    $result = $site_db->query($sql);


add after i.image_media_file,:
Code: [Select]
i.image_thumb_file,

find:
Code: [Select]
echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank>".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];

add after target=_blank>:
Code: [Select]
<img src=\"".THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />

final code should look like this if you just want to cut and paste the entire section:
Code: [Select]
   $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, i.image_date".get_user_table_field(", u.", "user_name")."
            FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u
            WHERE $condition AND ".get_user_table_field("u.", "user_id")." = i.user_id
            ORDER BY $orderby $direction
            LIMIT $limitstart, $limitnumber";
    $result = $site_db->query($sql);

    while ($image_row = $site_db->fetch_array($result)) {
      echo "<tr class=\"".get_row_bg()."\">";
      echo "<td><input type=\"checkbox\" name=\"deleteimages[]\" value=\"".$image_row['image_id']."\" /></td>";

      echo "<td><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\" target=_blank><img src=\"".THUMB_PATH."/".$image_row['cat_id']."/".$image_row['image_thumb_file']."\" width=\"40\" height=\"40\" border=\"1\" alt=\"\" />".htmlspecialchars($image_row['image_name'])."</a></b> (".$image_row['image_media_file'];

6
I am having a problem.  My category link now always brings up my first subcategory and my image links bring up the first picture in that subcategory.  When I look at the status bar, it is passing the correct cat_id or image_id.  It seems that what is passed is getting ignored/overridden somewhere along the way.  This happens everywhere, even in admin control panel.  Other things still work like search, random, and new images.  However, when you click on any of the thumbnails those show, it brings up that same first image.

I know it worked OK less than 24 hours ago.  I put in a several mods since then and am not sure which one might have done this.  Some of the mods I put in were to show the users comments and downloads, most users ever online, and additional gallery stats.  Since these didn't directly affect images, I didn't try the image links after each one.

Any help would be appreciated.

7
This mod will show logged in users all images added since their last visit.  If not logged on, it will work the same as the 'New Images' link.

search.php (if you are using 4images v1.7.2 or newer, the following two changes must be done in global.php instead)
find:
Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
  $search_new_images = 1;
comment out or remove:  
Code: [Select]
$search_new_images = 1;add after:
Code: [Select]
 $search_new_images = (isset($HTTP_POST_VARS['search_new_images'])) ? trim($HTTP_POST_VARS['search_new_images']) : urldecode(trim($HTTP_GET_VARS['search_new_images']));Note:  Need this change because otherwise whatever was passed in got overidden with 1

search.php
find:
Code: [Select]
if ($search_new_images && $show_result == 1) {
  $search_id['search_new_images'] = 1;
}
add after:
Code: [Select]
if ($search_new_images == 2) {
  $search_id['search_new_images'] = 2;
}
find:
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }
add after:
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 2) {
     if ($user_info['user_level'] != GUEST) {        
         $new_cutoff = $user_info['user_lastvisit'];
     }
     else {  
         $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];  
     }
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

page_header.php
find:
Code: [Select]
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),add after:
Code: [Select]
"url_new_images_last" => $site_sess->url(ROOT_PATH."search.php?search_new_images=2"),find:
Code: [Select]
"lang_new_images" => $lang['new_images'],add after:
Code: [Select]
"lang_new_images_last" => $lang['new_images_last'],
lang/xxx/main.php
find:
Code: [Select]
$lang['new_images'] = "New images";add after:
Code: [Select]
$lang['new_images_last'] = "New images since last visit";
templates/xxx/home.html
Wherever you prefer near the new_images and top_images logic add:
Code: [Select]
<a href="{url_new_images_last}" title="If logged in, click to see all images added since your last visit"><b>{lang_new_images_last}</b></a>&nbsp;                  
Also change any other template html screen that has the new images and top images links in them.  I only put the 'title=' code on my home page template, but you could put it in all or none.

To see it in action, visit http://www.jenrichardsphotography.com, although you would have to register and hope I add images before you visit the next time to see it work fully, so that may not be very practical. :D

8
This mod will allow you to find all images containing the same keywords as the current image or thumbnail.  The thumbnails returned will contain all of the keywords of the selected image, but may have additional keywords of their own as well.  I wanted this because my images aren't always sorted in an order that groups like images together.  For example, I have a folder with zoo pictures, but they don't show up in order of animal, so this button will bring up all images of that animal (if your keywords are set up well - mine still need some work :oops: ).  Here is what to change:

lang/english(or other language)/main.php - add the following lines (I added mine under the misc and alt language headings):
Code: [Select]
$lang['morelike'] = "More Like This";
$lang['alt_morelike'] = "Find more images with these keywords";  


functions.php (this is where I added mine, but probably could go other places)
find:
Code: [Select]
if (!check_permission("auth_sendpostcard", $image_row['cat_id'])) {
    $postcard_button = "<img src=\"".get_gallery_image("postcard_off.gif")."\" border=\"0\" alt=\"".$lang['alt_postcard_off']."\"/>";
  }
  else {
    $postcard_button = "<a href=\"".$site_sess->url(ROOT_PATH."postcards.php?".URL_IMAGE_ID."=".$image_row['image_id'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\"><img src=\"".get_gallery_image("postcard.gif")."\" border=\"0\" alt=\"".$lang['alt_postcard']."\"/></a>";
  }

and add after:
Code: [Select]
 $morelike_link = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".$image_row['image_keywords'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">More Like This</a>";

  $morelike_button = "<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".$image_row['image_keywords'].((!empty($mode)) ? "&amp;mode=".$mode : ""))."\"><img src=\"".get_gallery_image("morelike.gif")."\" border=\"0\" alt=\"".$lang['alt_morelike']."\"/></a>";

Note:  I had to type 'More Like This' for the link, because I couldn't get it to work using lang_morelike.  I tried several variations without success, so if someone fixes this part please post the change.

find:
Code: [Select]
   "postcard_button" => $postcard_button,
and add after:
Code: [Select]

    "morelike_button" => $morelike_button,
    "morelike_link" => $morelike_link,


search.php
find:
Code: [Select]
if (isset($HTTP_POST_VARS['search_terms'])) {
  $search_terms = (trim($HTTP_POST_VARS['search_terms']) == "all") ? 1 : 0;
}
else {
    $search_terms = 0;
}

change search_terms = 0 to:
   
Code: [Select]
$search_terms = 1;
Note:  I tried to get this mod to work by passing a search_term=all, but it didn't work, so I just changed the default to be AND.  I prefer this as the default for all my searches anyway.
 
in detail.html add {morelike_button} beneath image by other buttons or wherever you prefer it to be.

in thumnail_bit.html add {morelike_link} above lightbox button or wherever you want it.

You will also need a button called morelike.gif in your templates/xxx/images folder.  I tried to cut and paste mine here, but couldn't get it to work  (Jan, if there is a way let me know, or I can email it to you).  All I did was take one of my other buttons and modified the text on it.

If you want to see it in action, check out:
http://www.jenrichardsphotography.com

This is my first mod, so forgive any code that could be done better.  Hopefully some one else will find this useful.

9
I am having a strange problem.  Everything works fine if I type in a seach in the seach box or click on a keyword on the detail page or advanced seach page.  However, if I type it in the box on the advanced search page, it never finds any images.  I have tried searching in a specific category, changing the and/or radio button, looking for keywords or all fields, and nothing works.  Is there any special logic the advanced search page calls that the other searches don't?

10
I am working on a mod to do a 'More Like This' search that uses all keywords associated with an image to find others with those exact keywords.  Here is an example of the shortcut I am using:
Quote
Shortcut to search.php?search_terms=all&search_keywords=Animal Bird Milwaukee_County_Zoo


It works except it seems to seach with an 'OR' instead of 'AND'.  I have tried making search_terms=all and search_terms=1, but neither seems to work.  Can anyone help me with the syntax?

If anyone wants to try it, go to the details page and click on the 'More Like This' link under any image at  http://www.jenrichardsphotography.com

11
I added some new image date fields and was having problems displaying them with the way everything is so automated.  Here is how I got the dates to display correctly (additions in bold):

functions.php
find:
Code: [Select]
if (!empty($additional_image_fields)) {
    $additional_field_array = array();
    foreach ($additional_image_fields as $key => $val)
    {

add after:
 
Code: [Select]
if (($key == "image_add_date") || ($key == "image_create_date"))
{
         $additional_field_array[$key] = (!empty($image_row[$key])) ? format_date($config['date_format']." ".$config['time_format'],$image_row[$key], 1) : REPLACE_EMPTY;
         $additional_field_array['lang_'.$key] = $val[0];  
      }
else

12
I have added several new image fields like photographer and date_added (real date because other has IPTC date).  I would like the photographer to default to my name and the date to default to the current date.  There are a couple of spots in admin/checkimages.php that refer to the additional_fields, but I wasn't sure what code to and and where.  Any help would be appreciated.

13
If I have a category with several subcategories, often I do not have any images under the main category.  So, when you click on it, you don't see any images and just a list of subcategories.  Would it be possible to display all subcategory images under the main category and then if you only want to see a certain subcategory, you could click on it?  The category hierarchy is stored somewhere, so I was thinking there should be a way to point it to the other folders.  This could be an option under the control panel, so you could turn it off if you don't want it to work that way.

14
I love the ability to have IPTC description, keywords, and date automatically be filled in.  I like using the IPTC date for the date on my pictures; however, it does cause newly added pictures not to be marked as new if they were taken awhile ago.  Would it be possible to add a second date field (wouldn't have to be updateable or displayable on the screens) that contains the true add date and use that for marking photos as new?

15
I have my images sorting by rating first.  However, after that, there doesn't seem to be much of an order.  How can I modify the sort order code to sort by rating, then file name?

Pages: [1]