Member
Member
bll0   2012-03-21, 19:29
#1

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

Administrator
Administrator
acrylian   2012-03-21, 19:34
#2

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.

Member
Member
bll0   2012-03-21, 19:44
#3

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?

Administrator
Administrator
acrylian   2012-03-21, 20:05
#4

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).

Quote: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.

Member
Member
Wete   2012-03-22, 09:50
#5

acrylian, you wrote:

Quote: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

Administrator
Administrator
acrylian   2012-03-22, 11:13
#6

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.

Member
Member
bll0   2012-03-26, 20:58
#7

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

Administrator
Administrator
acrylian   2012-03-27, 10:05
#8

As said on lots of other topics already using the box instead of the image.php page requires some more changes.

Member
Member
sbillard   2012-03-27, 18:19
#9

I guess we should also point out that the Zenphoto hit counters all are associated with [b]pages[/b] 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.

Member
Member
bll0   2012-03-31, 09:55
#10

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

Member
Member
sbillard   2012-03-31, 19:02
#11

The hitcounter plugin registers a functon for the [i]load_theme_script[/i] filter. This function handles the hit counting. (The filter is invoked in the root index.php just before the theme page script is "required".)

Administrator
Administrator
acrylian   2012-04-01, 09:05
#12

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.

Junior Member
Junior Member
arthurpararas   2012-04-09, 08:31
#13

I was going to ask the same questions here but acrylian and sbillard fully covered me. Thnx a lot!

Member
Member
bll0   2012-04-23, 15:48
#14

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!

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.