Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorgac
    • CommentTimeJul 23rd 2008
     
    Hi again,

    I'm curious about how I can go about having an image show up beside newly created galleries or photos. Essentially, a tiny .gif that would say "New" on it, but only show up there for recently uploaded items and possibly expire after a set amount of time.

    Is this possible at all?

    Sincerely,
    GAC
    • CommentAuthorgac
    • CommentTimeJul 27th 2008
     
    Anyone have any ideas for this one?

    GAC
    • CommentAuthorgac
    • CommentTimeJul 31st 2008
     
    i'll bump this one more time and then leave it alone for good ... can someone help me with this please?

    G
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 1st 2008
     
    Hi gac,

    Sorry, but I've been working on other things for a little bit. I think I can help you out, but I need to do some testing on my installation before I post a solve for you.

    One question I had for you though. Did you want the "new" image to show up on galleries that have been newly created or only on those that have "new" images? I'll try to work on it soon and get back to you.
    • CommentAuthorgac
    • CommentTimeAug 1st 2008
     
    Ideally, it would show up on the galleries that have been newly created.

    To be honest, I'm open to whatever you can come up with for this one. I'll happy with any kind of functional method to let people know what's "new" on the gallery.

    Thank you for helping! I thought I was going to have to forget about trying this out.

    Sincerely,
    GAC
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 4th 2008
     
    Hi gac,

    I have a solution for you, but if you let me know which theme you are using, I can post the code for that particular theme. Let me know.
    • CommentAuthorgac
    • CommentTimeAug 4th 2008
     
    Hey Sid,

    I am using the default theme that appeared with the initial installation.

    I look forward to seeing the solution!

    Sincerely,
    GAC
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 5th 2008
     
    Alright, so I'll try to give line numbers and the first and last lines of code that I show should already be in the file (you will be adding the middle part).

    First, open 'collections.php' and edit it as follows (about lines 17-19):
    print '</a><br/>';

    // do we have new pictures?
    $time_new = strtotime("-1 day"); //change this to whatever time frame you would like i.e. -1 week or -3 days
    $image_time = intval($time_new) - 60; // set a default non-new time in case there are no pictures
    $sql = "SELECT `date_submitted` FROM ".TABLE_PREFIX."pictures WHERE `parent_collection` = '".plogger_get_collection_id()."' ORDER BY date_submitted ASC";
    $result = run_query($sql);
    while ($row = mysql_fetch_array($result)) {
    $image_time = strtotime($row['date_submitted']); // overwrites the $image_time variable with the date_submitted information from the database
    }
    if ($image_time > $time_new) {
    print '<img src="new.gif" alt="new pictures" />'; // output your image here
    }

    print plogger_download_checkbox(plogger_get_collection_id());


    Then do something similar for 'collection.php' (again around lines 17-19):
    print '</a> <br />';

    // do we have new pictures?
    $time_new = strtotime("-1 day"); //change this to whatever time frame you would like i.e. -1 week or -3 days
    $image_time = intval($time_new) - 60; // set a default time in case there are no pictures
    $sql = "SELECT `date_submitted` FROM ".TABLE_PREFIX."pictures WHERE `parent_album` = '".plogger_get_album_id()."' ORDER BY date_submitted ASC";
    $result = run_query($sql);
    while ($row = mysql_fetch_array($result)) {
    $image_time = strtotime($row['date_submitted']); // overwrites the $image_time variable with the date_submitted information from the database
    }
    if ($image_time > $time_new) {
    print '<img src="new.gif" alt="new pictures" />'; // output your image here
    }

    print plogger_download_checkbox(plogger_get_album_id());


    Finally, 'album.php' is slightly different since we already have the images in an array and can grab them via the plogger built-in functions (look around lines 22-24):
    print '<li class="thumbnail"><div class="tag"><a href="' . plogger_get_picture_url() . '">' . $imgtag . "</a><br />";

    // do we have new pictures?
    $time_new = strtotime("-1 day"); //change this to whatever time frame you would like i.e. -1 week or -3 days
    $image_time = strtotime(plogger_get_picture_date('Y-m-d H:i:s', true)); // set a default time in case there are no pictures
    if ($image_time > $time_new) {
    print '<img src="new.gif" alt="new pictures" />'; // output your image here
    }

    print plogger_download_checkbox(plogger_get_picture_id());


    That should do it for you! If you want your image to be in a different spot, just add the last bit where you want it to go or save it in a variable by doing this:
    $new = '<img src="new.gif" alt="new pictures" />'; // output your image here
    instead of the code above:
    print '<img src="new.gif" alt="new pictures" />'; // output your image here
    Then later just do a <?php print $new ?> wherever you would like the image to show up.

    Let us know if you run into any problems!
    • CommentAuthorgac
    • CommentTimeAug 6th 2008
     
    Hey Sid!

    I got the "new" image to work fine -- but something wonky is happening with my albums now. I may have made an error somewhere. I'll link my gallery here to show you what I mean:

    http://www.rhododendrongardens.ca/main.php?level=album&id=12

    Any idea what I might have done here ?

    Sincerely,
    GAC
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 6th 2008
     
    gac, it looks like you are missing a closing
    and closing tags. This looks to only be in your 'album.php' file and should be the next line after the code above:
    print plogger_download_checkbox(plogger_get_picture_id());

    print '</div></li>';
    • CommentAuthorgac
    • CommentTimeAug 6th 2008
     
    perfect! thank you so much. it's working fine now. thank you for all your help.

    sincerely,
    GAC
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 6th 2008
     
    excellent gac!