Adding custom image .php page with single images

I am beginning to understand how to manipulate ZenPhoto/Zenpage pretty well, but I have come across a stumbling block that is pretty hard to search for, so forgive me if this has been addressed in a previous thread.

Basically what I want to do is create a 'custom page' that is called from an image page and is an alternate of image.php. This page would display unscaled images one at a time in full screen with nothing else on the page but «prev next» navigation and a close button that returns you to the original image.php.

I know this is what slideshow (js or colorbox) does, but my boss is insistent that the full screen navigation mode works without any javascript.

I think the URL should somehow be addressing the full screen image page differently than the standard image page, such as http://mysite.com/album1/Photo1.jpg-full.php or something similar.

According to the theming tutorial the only page that calls up images is image.php, is there any way to duplicate that functionality on a different page without messing with the zenphoto core? Zenpage custom pages I don't think will work because they don't call up images as mentioned in the theming tutorial.

Thanks in advance, and feel free to ask more questions.

Stan

Comments

  • acrylian Administrator, Developer
    You are more or less on the right track. You need to create a custom theme page (named maybe "fullimage.php" - see the theming tutorial) and then pass the image filename and the album folder name via GET or POST to that page.

    Then you need to create an image object of that image using the object model (see its tutorial) and make that current using the makeImageCurrent() function (see the doc for correct spelling). You need to do that because you want the prev/next navigation on that page and the link to return to the normal image.php page.

    Alternatively you could just stay on the standard image.php page and use a GET command to switch the display.
  • Unless you are willing to make custom rewrite rules your url will look something like `mydomain/page/fullimage?album=&image=` Then you would have code like `$image = newImage(NULL, array('folder'=>sanitize($_GET['album'],'filename'=>sanitize($_GET['image']));`
  • Thanks for the quick replies, so I made a duplicate page called "imagefull.php", basically it is a copy of slideshow.php with the printSlideShow lines removed. I figured this was a good place to start based on the tutorial.

    in the <head> of this file I put sbillard's code with a few extra lines to make a variable for the current image.
    `
    <?php
    $image = newImage(NULL, array('folder'=>sanitize($_GET['album'],'filename'=>sanitize($_GET['image']));
    $image = makeImageCurrent($image);
    $fullimgurl = getFullImageURL();
    ?>
    `
    then to start with getting the full image in there I put something like:
    `
    image" />
    `
    in the body.

    to switch to the imagefull page from the image.php page I would just have an href like:

    `
    getFolder() ?>&image=<?php echo $_zp_current_image->getFileName() ?>">FULL
    `
    One problem is that the album is actually a subalbum, so "album/subalbum" gets thrown into the URL. Not sure where I am going wrong, I'm learning more advanced PHP as I go here.

    having a sloppy URL is not really a big deal, since the full size pages are duplicates. I can always add mod_rewrites to the .htaccess later.

    Thanks again, I think I am really close!
  • The album "name" is acatually the full path to the album from the albums folder. Otherwise there would be no way to tell the difference between same named subalbums of different parent albums. So `album/subalbum` is necessary.
  • After messing around with passing the variables via URLs, I just stumbled upon what might be a MUCH easier and cleaner way to do it ... if possible. Seems like the multiple_layouts plugin is exactly what is needed. I already made a dupe of the image.php called image-full.php, which will have the fullscreen layout. Works fine for switching layouts on a per image basis, but there has to be a way to switch layouts on the fly from within a the image page.

    http://www.zenphoto.org/documentation/plugins/_zp-extensions---multiple_layouts.php.html, could you use

    `GetLayout()`

    which says it "Gets the select layout page and returns it to the load_theme_script filter"

    along with
    `zp_apply_filter()` and `load_theme_script`

    to do this with a button?

    Thanks
  • Multiple_layouts provides an alternative image page, not an additional one. So really not what you requested.

    You still have to have a means to decide to switch layouts on the fly. That is what the URLs are all about. So your button would either create a URL with the selector and you use $_GET to check for it or it would POST the selector and you would use $_POST to check for it.

    Small step to have the url for the request go to your custom page--no other "magic" needed.

    If you wish, you could implement a pugin with a filter for `load_theme_script` which did the switching, but you still have to have some clue in the page request to decide to do so.
Sign In or Register to comment.