almost there - latest images and lightbox

first of all, thank you Zenphoto makers for this awesome script. i've been having a hard time arranging my gallery and having to deal with 2342452 html pages and stuff but this script made everything a piece of cake! ..

even though i know nothing about php or working with scripts in general i was able to install zenphoto without any problems .. i even got around integrating it nicely into my own homepage and i already solved many little problems thanks to the many threads here ..

i still have two tiny problems i tried my best to find the answers to them here before bothering anyone but didn't find anything .. so im hoping someone will guide me with my problems .. please ?

im using the default theme which i customized to fit my site.
i want the full image link in the image.php to open in a lightbox instead of a new window. i already linked my image.php to the lightbox js and double checked my links and codes to make sure everything is coded and linked properly and im sure its all fine or atleast i hope it is.
now, the real problem: i know i have to add `rel="lightbox"` somewhere in the "image" div of my image.php but seeing that i have no knowledge of php i dont know exactly where to put `rel="lightbox"` ?? could someone please tell me where to add it in the code below ?
`

" title="<?php echo getImageTitle();?>"> <?php printDefaultSizedImage(getImageTitle()); ?>`

or am i doing it wrong in the first place O_O??

my second problem is that i want to use the 'latest images' hack which is here : http://www.zenphoto.org/trac/wiki/ZenphotoHacks but i dont know where exactly to put it.
i know that i must save the codes of that hack in a new php file and upload it to my Zen directory and then link to it via a php include in the index.php of my gallery where i want it to show. could someone please correct me if im wrong ? is this how im supposed to do it ?
if yes, then how do i make the php include so that the thumbs are displayed correctly ?

im really sorry for talking so much but i want to make my problems clear.
and sorry for my poor english .. T_T

here is the link to my gallery : http://lillymon.net/artworks
any help will be greatly appreciated .. thank you in advance

Comments

  • You need to add the rel="lightbox" to the anchor (link) tag. You can put it after the title in the link tag, like so:

    `" title="<?php echo getImageTitle();?>" rel="lightbox"> <?php printDefaultSizedImage(getImageTitle()); ?>`
  • The best way to add the 'latest images' hack is to copy the code to a file named (for instance) custom-functions.php. Then you stick `require_once('customfunctions.php');` in with the line that currently reads `<?php zenJavascript(); ?>` so it would read `<?php zenJavascript(); require_once('custom-functions.php'); ?>`
  • @dspnorman:
    thank you so much for your help. i tried what you said but nothing happened and the link stopped opening in a new window.

    i added it like this `

    " title="<?php echo getImageTitle();?>" rel="lightbox[<?=getImageTitle();?>]"> <?php printDefaultSizedImage(getImageTitle()); ?>

    `
    but its still not working.
    i re-checked everything once again but i can't find where things went wrong.
    any suggestion please ?

    @sbillard:
    i tried your suggestion but it gives me an error. i made a custom-functions.php file with the hack codes, uploaded it to zen directory and linked to it in my index.php but the codes show at the top of the page and nothing else happens ..
    is there any other way to make the latest thumbs show ?

    thank you both of you for your time and help
    =)
  • The correct code, like dspnorman had said, should be:

    `" title="<?php echo getImageTitle();?>" rel="lightbox"> <?php printDefaultSizedImage(getImageTitle()); ?>`

    The problem was you were adding an extra `[<?=getImageTitle();?>]` right after the word `lightbox`.

    Try it again without that and see if that works for you.
  • i did try it without that extra bit but it still didn't work .. it only stops the image from opening in a new window.

    =(
  • from a quick glance, it looks like you are missing some css. Otherwise, it looks like it is working.
  • thanks alot penzoto .. dspnorman was right but i totally forgot to fix the lightbox css .. it shows up now but something makes me think lightbox is not meant for using with big images because the black overlay always breaks when viewing big images but looks fine with smaller ones .. anyways, i'll skip the lightbox ..

    but i still need to figure out how to use the hack for the latest images .. any help with that please ? im a fast learner so yeah, any help will be appreciated =)
  • acrylian Administrator, Developer
    Just make a php-file called "latest_images.php" and place it within your theme folder. It should look like this:
    `<?php<br />
    /* Show Latest Images */

    function show_latest_images($number) {

    $iw = $cw = zp_conf('thumb_crop_width');

    $ih = $ch = zp_conf('thumb_crop_height');

    $sql = "SELECT * FROM ". prefix("images") ." ORDER BY id DESC LIMIT $number";

    $result = mysql_query($sql);

    while($r = mysql_fetch_array($result)) {

    $id=$r['albumid'];

    $sql="SELECT * FROM ". prefix("albums") ." WHERE id = $id";

    $album = mysql_query($sql);

    $a = mysql_fetch_array($album);

    echo '';

    echo '';

    echo ''.$r['title'].'';

    // echo 'Test';

    echo '
    ';

    echo '';

    }

    }

    ; ?>`

    Then place `<?php require_once('latest_images.php'); ?>` within the head of your theme file.

    Then place `<?php show_latest_images(4); ?>` within the html-body where you want to show the latest images.

    The "4" means in this case the 4 latest images are shown.

    PS: Don't you think that the pictures on your gallery need to be a little compressed. 300-400k for pictures of that shown size is not necessary.
    And for the really big ones, you could use just a download link.
  • @acrylian :
    your codes worked perfectly !! .. as for the gallery images, thank you so much for your suggestion .. i never thought of doing this compression thing but i will do it soon ..
    thank you very much for taking the time to help out :)
  • How would I make this work to display on an external site?

    like if I wanted to display this on index.php in the root of my site, when I have zenphoto in /gallery/ of my root.
Sign In or Register to comment.