Capturing the image view count on click while using jquery fancybox - php

does anyone have an idea on how I could capture the image id when a user clicks the next / previous button in Fancybox? I like how Fancybox changes depending on the size of the image so I prefer to use this over some of the other galleries that I have seen. Has anyone successfully done this? The site is in PHP.

The general idea would be to "proxy" your images by a PHP script.
This script would:
add 1 to the view count of the image
serves the image to the browser (instead of serving an HTML page as usual)
You would then update the src attribute of your pictures img tag :
<img src="mypicture.png"/>
would become
<img src="view_picture.php?picture=1"/>
Note that you must be careful and not authorize a filename in the picture parameter and/or carrefully check that the user is not trying to see a file that you don't want to show him (think view_picture.php?picture=../.htpasswd )

Consider using a general website analytics software, like Piwik. This will give you additional insights on you visitors and their actions on your site, rather than a simple image view counter.
I am running a site that uses Fancybox and Piwik, all image views through Fancybox will automatically show up in the Downloads section of Piwik reports without any additional configuration.
But you could easily customize this through Fancybox's onComplete callback and Piwik's trackPageView(). See Piwik Javascript API and Fancybox API for details.

Related

FB Share pop-up different window than what is posted

I'm new to using the FB share buttons terminology so forgive me if I use the wrong syntax in describing this.
My site is setup to load pages based on the passed parameters in the URL (...?page=somepage&imageid=idnum).
So I have my index file which contains my head, as well as sidebar, etc. Then my main body is generated according to the passed parameter. Simple Enough.
On the homepage, the main body is a gallery of images. When they click on one of those images it takes them to a page that just displays that one image. The page is loaded with parameters of ?page=detail&image_id=1 /*or whatever the id of that image is */
So when they click on the share on FB button on those individual images page, I would like it to populate with the image that is displayed on that page. What I have done is included a php file in my head tag. The php script included gets the page info and passed parameters and then fills out the image url based on the imageid.
echo '<meta property="og:image" content="http://www.chiseledimages.com/clients/vote/'.$imgurl.'"/>';
This works in that when displaying the page source, the meta tag with og:image shows perfectly, also in that when I run it through the FB Object debugger, it gets the correct image and doesn't show me any errors. It even posts the correct image when the users shares on their wall. What is does not do, is show the correct image in the pop window after the uses presses the share button on my site. So even though the result is what I want, the problem with the user not seeing the correct image in the share pop-up, may lead them not to want to share on their wall.
Current location of site: http://www.chiseledimages.com/clients/vote/
Example of a specific pages: http://chiseledimages.com/clients/vote/?page=detail&angel_id=1
Screenshots of pop-up with wrong image, but final posted story having correct image.
How can I make the image in the pop-up match the image that is going to be shared. Thanks.
Edit: I forgot to mention and I'm sure it matters that I'm using Addthis to implement the FB share.
Check https://developers.facebook.com/docs/reference/dialogs/feed/ - look for the 'picture' parameter description
I suggest to you use this http://support.addthis.com/customer/portal/articles/1365475-attribute-based-configuration#.UwPQB6LW6So. just follow their example and you good to go.

How to open image href on a aspx page

When the thumbnail is clicked I would like the full size image to open on http//example.com/image.aspx instead of http//example.com/images/image.jpeg without creating an individual page for each image and editing each href. I know that this is possible with php but I was wondering if there was some way of doing it with javascript, jquery, asp.net, or...? If it is possible, (I maybe stretching it here), would it also be possible to run this on the master page for all thumbs? The thumbs have no class or id. Right now they are in straight html markup. I have searched for days and have found nothing that would even get me started on the correct path with the exception of php. I don't need the target blank if I could implement this because this would allow me to open the image on a aspx content page with full site navigation. Here is the code as of right now.
<a target="_blank" href="image.jpg/jpeg"><img alt="something" src="pictures/image_small.jpg/jpeg"></a>
A page from our site is http://backalleypics.com/PeoplesPages/Sa~Se/SarahShahiPages/SarahShahi1.aspx. An example of the php type is http://www.theplace2.ru/photos/gallery.php?id=47 I really don't want a gallery, pop up window, or light box. The purpose is to get ad views for each image click and have navigation on the page.
You can use an existing library that do that, like the: http://highslide.com/
There are also many others, some of them:
http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm
http://valums.com/javascript-image-galleries/

Dynamic page thumbnails

I need a way to automatically generate a thumbnail of the target page when the user hover over a URL (hyperlink) on my page.
I've found several examples of people using pre-created .gifs (or other images) to show a thumbnail of the target site while hovering over the link (see example #1), but I need a way to do this dynamically. Is there a way to generate a thumbnail of a page, either on runtime, or an easy way to update the current thumbnail after editing a page?
Simply put; I need to show a thumbnail of the target page when hovering a hyperlink on my page. This thumbnail should not be based on an image that I have to generate myself after each edit, but rather a snapshot of the current page. Much like google does when searching for websites.
Thanks a lot in advance!
Example #1:
http://www.dynamicdrive.com/style/csslibrary/item/css-popup-image-viewer/
Hover your mouse over "Zoka Coffee"..
Try to study about this library html2canvas

Use javascript to read/write images to IndexedDB

I need help writing javascript (jquery?) for a web app to save a set of images to an IndexedDB and then load them into an html page.
I have two html pages, img.html that is just a listing of images in this format:
'image-id','base64-image'
and index.html, my main page that includes a series of image tags in this format:
<img name="imglist" id="image-id" img-src="">
I'd like the user to be able to click a button to load all of the images from img.html into IndexedDB and then click another button to read the images from IndexedDB and insert them into the appropriate image tag in index.html (the 'image-id' in img.html corresponds to the appropriate img tag id in index.html).
Also, is it possible to set a cookie (or some other method) that will cause the DB to be erased after a certain time period? I'd like to be able to force the user to re-load the images from the server about once a week.
I'm not great with javascript or indexeddb, so any help or examples would be great.
See the article titled Storing images and files in IndexedDB.
N.B. I just posted a similar question here, though it concerns the particular case of a cross-site request. If your requests are on the same site, the link above should be a perfect example for you to work by.

Get website image from google via php

I'm working on a website for a specific client. And he wants to be able to add link to the website, and on mouse hover to have a image of that website appear.
Now, he doesen't want to take an image of the website, he only wants to input the link and have the website do everything else.
So my question is ->
Is there a way (eg. google API) to get a website image only by providing the url via php?
Sort of like in google, when you hover over a lik of a page, a tooltip pops up to the right with an image.
Any help is, as always, appriciated :)
Here is a list of 10 free thumbnail services
http://www.webresourcesdepot.com/10-free-website-thumbnail-generation-services/
You can simply refer to the URLs of these services, e.g.
<img src="http://SnapCasa.com/Get.aspx?code=[code]&size=[size]&url=[url]" />
or make a CURL call from one of your PHP scripts and temporarily store/permanently save the image that was generated.
Have recently developed Thumbnailspro.com. It is currently free to use while in beta testing as we work out the bugs, but so far its getting quite popular, you can request thumbnails directly from your website using the code below :
http://thumbnailspro.com/thumb/http://msn.com&s=150
s=Size, size can be anywhere from 10 to 1000 pixels just add s=300 to display a thumbnail 300 pixels in width. We are trying to add more options as we go for thumbnail requests and at the same time trying to keep it as simple as possible so you don't have to enter something like the code below to get your thumbnails :
http://somethumbnailsite.com/viewurl.php?url=http://msn.com&x=200&y=300&bwidth=1024&bheight=768&rotate=76&what_the_hell%20_is_all_this_crap!
So is much more effecient!
Like the service or have any bugs contact us at admin#thumbnailspro.com!
No. The only way to do this is to request the HTML for the page, render the page and then create a thumbnail from that page render. Google does this because in the process of spidering the web, they already get all that data, and they've got a nice optimized rendering engine (Chrome) that they can put the data through, and then they've got tons of online storage space to store the cached image. There's a lot of work there, though.

Categories