5

I'm working on a mobile site and designing a sliding gallery which has Images & Videos. If I click on video, it open in Youtube and works fine. Here is the code I use.

<a href="http://www.youtube.com/v/YouTubeID?version=3&hl=en_US">
<img class="sliderImage" src="http://img.youtube.com/vi/YouTubeID/0.jpg" alt="Video" />
</a>

i want similar functionality with images so that it gets open in the Default Image Gallery like Android Image Gallery, Windows Mobile Photo Viewer etc as per the mobile device.

Here is the code

<a href="Some Image URL">
<img class="sliderImage" src="Some Image URL" alt="It's Better" />
</a>

I think, there is something needed in href to redirect the image to gallery but I do not know what that could be.

It would be really helpful if someone can point me in right direction.

Thanks in advance.

  • This post may be helpful to you. [link](http://stackoverflow.com/questions/5644218/how-to-handle-html-image-click-events-in-android) – Ali Hassan Oct 18 '12 at 15:23

2 Answers2

2

One way to do it is to set the image's mimetype to a value that is by default downloaded, such as application/octet-stream.

If you can't access the file to change the mimetype, you can just change the mimetype of the HTTP response (PHP example)

The post is talking about MP3's, but the method works for images as well.

NH.
  • 2,240
  • 2
  • 23
  • 37
0

If you want to do it, you can use below code. I try it and it's working, but that image link will not open in "Image viewer".. that will open in Browser..

<a href="file://c:/user/documents/images/abc.png">
<img class="sliderImage" src="Some Image url" alt="It's working">
</a>

may be that image open in "image viewer", but it will surely open in browser ..