Question

I have a link of an image. Image is hosted in server. Now with a button click or image click I want to open that image with native apps. Like in android image viewer or iOS image viewer so that I can zoom-in or zoom-out etc.

<a href="http://www.example.com/potenga3.jpg" class="" title="Potenga 3">
    <img src="img/thumb/potenga3_t.jpg" alt="image" class="one_third">
</a>

I tried this.

<a href="#" onclick="window.open('file:///path_to_image', '_system', ' ');">Image</a>

Didn't work. What's the simple way to do it. If a common solution doesn't exist for both ios & android os, you can suggest me only for android right now.

Was it helpful?

Solution

I nedded to use the native code for android

    Intent intent = new Intent();
     intent.setAction(Intent.ACTION_VIEW);
     intent.setDataAndType(Uri.parse(fileURI), "image/jpeg");
     startActivity(intent);

OTHER TIPS

On iOS you can use the inAppBrowser, it lets you zoom in and out

for android you can use this plugin https://github.com/SpiderOak/FileViewerPlugin or search for another plugin that uses intents

or this one with examples

https://github.com/markeeftb/FileOpener

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top