Hitcounter with Box images

Hi folks,
I am using fancybox for showing my images. As I need to link to the images directly and not to the image view page, the hitcounter does not work.
Does anyone have an idea how I can get the hitcounter to work in this scenario?
Thanks and regards,
bll0

Comments

  • acrylian Administrator, Developer
    Calling the image directly involves certainly no Zenphoto script so there is no "easy" way (which you probably have in mind): You could:
    - use a custom theme page to call the full image on. ++
    - user some jQuery JS to use ajax to call a separate page to count.

    In any case this will require some work and knowledge by you and getting familiar with some Zenphoto internals. You should read the theming tutorial for the basics first.
  • bll0 Member
    Thanks for the fast answer!

    The first variant would be to call a page with the embedded image in the fancybox I assume. So the fancybox needs to open a page instead of a picture... Not sure if it does support page viewing.

    The second jQuery might be to difficult for me as I am not to familiar with jQuery. Do you have a hint where to start in the code? Maybe here: $(document).ready(function()?

    Is there a way to do this with the colorbox plugin or does this have the same impact on the hitcount? Does colorbox support page viewing?
  • acrylian Administrator, Developer
    All the "box" popup image scripts work the same way. So for Colorbox it is the same. I can at least say that calling a page is possible with the Colorbox.(not familiar with Fancybox but probably it can do that as well).
    The first variant would be to call a page with the embedded image in the fancybox I assume.
    No, actually I am talking about a custom theme page (see the theming tutorialI) you will have to pass the album a nd image name and call the image on. It is not that complicated but not that easy if you are not familar with such things generally and Zenphoto specifically.
  • Wete Member
    acrylian, you wrote:
    Calling the image directly involves certainly no Zenphoto script

    How about `$imageobject->getFullImage()` which returns the URL of the image?

    I think, it would be possible to add/modify the function getFullImage() so that the counter is considered. But of course this would mean to modify core files!
    And the counter would add up every time the album is viewed, not the very image. It's inelegant.

    Fancybox does support opening html pages instead of pictures, but I think, this is also very inelegant.

    Wete
  • acrylian Administrator, Developer
    The method you cite just gives you the url to the full image. As said, to use the hitcounter the image must be on a theme page that is called or you have to use js/ajax on opening the "box" script. A direclty called images is just an image.

    The best and easiest is to use a "custom theme page" for this. What that is is explained on the theming tutorial. You should also get familiar with the object model as you will need that to create the image object on that custom page.
  • bll0 Member
    I agree that maybe a custom image.php is a variant. But still there is the need to have a deep look into the box script, as I would like to have the navigation by clicking on the image. And that I do not see implemented at the moment...
  • acrylian Administrator, Developer
    As said on lots of other topics already using the box instead of the image.php page requires some more changes.
  • I guess we should also point out that the Zenphoto hit counters all are associated with pages not specific content that might be on that page. So there is a hitcounter for the image.php page that displays your image like there is a hitcounter for the album page that displays the album but not for sub-pages of the album.

    If you want to count hits for when the image is viewed via a "box" script you will have to incorporate that into how the box script displays the image. Presumably that means having a script that causes the display and also counts the hit. Or at least a script for counting the hit that can be ajaxed from the box handler when it displays the image. Both are possible, but do require implementation.
  • bll0 Member
    I am thinking at the moment of some approaches to increment the hitcounter. But for this I need to know how the increment of the image hitcounter is called in the "normal way".

    Can you tell me, how the function call of the image counter increment is called? After studying the different image.php examples I am not sure where to look.

    I assume it is in the zp_apply_filter(), but have not found that function yet...
  • The hitcounter plugin registers a functon for the load_theme_script filter. This function handles the hit counting. (The filter is invoked in the root `index.php` just before the theme page script is "required".)
  • acrylian Administrator, Developer
    Again, I recommend to look into the theme basics and use a theme custom page. The hitcounter is invoked on all theme pages automatically if enabled.
  • I was going to ask the same questions here but acrylian and sbillard fully covered me. Thnx a lot!
  • bll0 Member
    Thank you guys, I think to understand the solution.

    When I have time, I will implement a custom page with arrows, which will be loaded in a box frame. That gives the user a similar feeling like having the box frame and I can use all the nice built in gimmicks from zenphoto.

    Thanks again!
Sign In or Register to comment.