Open image with default image viewer in Android - javascript

I have in my Jquery-mobile/phonegap application an "img src" tag that put an image on my page. Is it possible to click on that image and the image will open with the default viewer in android? I tried a hyperlink with the uri but I get then a page with undefined.
uri:
file:///mnt/sdcard/test/images.jpeg

This is possible, but you will need to make a plugin. That plugin should capture your data (/test/images.jpeg) and generate an Intent to open the file with the default Image viewer.
Check a blogpost of me. It is about an appstore Intent, but it should get you going.
http://teusink.blogspot.nl/2013/08/phonegap-android-appstore-plugin.html

Related

Refreshing a particular div content using javascript / jQuery

I have a JQuery div element. It displays a picture on the screen. The image is stored in the device memory and is being replaced in continuous interval (with same file name)
Once the image is displayed It's stuck there, I want it to load the latest image ( saved on the memory) by itself when ever I visit this div back in any given time.
Im using javascript to develop this App.
Any little help is appreciated.
[update]
This is my code, just the standard way to display the image.
<img src="/storage/emulated/0/Images/1.png" width="128" height="128">
The image 1.png will be replaced in regular intervals. I want this to be updated on the screen.
What you get from sdcard is a FILE_URI object such as (file://storage/emulated/0/Images/1.png) or you get DATA_URL object which is just the Base64 converted string of above.The html img tag accept FILE_URI and DATA_URL directly.
Since cordova camera plugin just allow user to select a image to view/edit or click a image then we can use cordova file plugin to create a functioning gallery app.
add cordova file plugin to your project:
cordova plugin add cordova-plugin-file
Then create a handler to provide you the path of the images(Syntax):
window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function
(dirEntry) {
console.log('file system open: ' + dirEntry.name);
var isAppend = true;
createFile(dirEntry, "fileToAppend.txt", isAppend); }, onErrorLoadFs);
For details of this plugin:https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/
You can download test gallery app showing images from DCIM/Camera folder(default) into html img tag onto user screen:
https://drive.google.com/open?id=0B8vJcyO8_PK9R1k4STUyaEJQS1k

I want Google Docs embeddable PDF viewer not to display "open external" link

I am making a pdf viewer using google doc viewer. I am facing an issue. I don't want the user to download the pdf. If user clicks open external button, an external application is opened and pdf can be viewed. I don't want that button. What can I do?
Please see the attached image.
Add rm=minimal to the URL and you will scale of features from your viewer.
Here is an example with rm=minimal in the URL:
https://docs.google.com/spreadsheets/d/1byEvnxDkjQ49GNqRldHJyBrptlibFVItO_eneLypWic/edit?rm=minimal#gid=0
And here is an example without rm=minimal in the URL:
https://docs.google.com/spreadsheets/d/1byEvnxDkjQ49GNqRldHJyBrptlibFVItO_eneLypWic/edit#gid=0
I think that what you can´t remove with rm=minimal can´t be removed unfortunately.
Update
If rm-minimal can´t scale of what you want you could try to remove the element by jQuery with:
$(".ndfHFb-c4YZDc-Wrql6b-SmKAyb").remove(); or by CSS: .css('display','none')

How do I set view/zoom level of an embed PDF?

I am trying to set the view of an embed PDF. I want it so that when the user clicks and opens the PDF in their browser, the view mode is already set to page width instead of the default automatic zoom.
I have looked at this pdf: http://www.heinelt.info/pdf/PDFOpenParameters.pdf for help.
Adding
#view=FitH
At the end of the url is what the pdf says to do, but that doesnt work, although things like page jumping ( #page=3 ) do.
Here is how I have my pdf linked
<a href="javascript:loadPDF('http://www.pdfpdf.com/samples/Sample3.PDF#view=FitH');"
The " javascript:loadPDF " before the link is for embedding the PDF, so that the pdf opens inside the same page. (So the PDF doesnt navigate away from the page or open in a new pdf.)
Help? Am I using the #view=FitH wrong?

Colorbox displays image as binary data

I'm trying to use Colorbox for a website build using Backbone.js. I've got a simple image tag like this:
<a class="gallery" href="/document/123"><img class="attachment-preview" src="/document/123" /></a>
The url /document/123 displays the (simple png) image. 123 is the id of the image, and the server gets the base64 encoded image from the DB, decodes it, and displays it. When I put in example.com/document/123 in the browser it displays the image correctly, and the image is also correctly displayed with the tag I pasted above.
When I then click the image however, the colorbox opens and only shows what I guess is binary data:
�wQH*��:�R��hc�:+{�����d��j���}7u($��#�����[�6Ym}���^(_�i�~�H�>�� etc..
So my question are: how can this be? And more importantly: how can I solve it? All tips are welcome!
Colorbox will automatically detect the content type of the href target by the extension name of url. For example, color box will display content as image if url target is a file with .jpg, .png or .gif extension. Url "/document/123" will be treated as html content even through it returns a image.
You could solve this issue by adding photo: true attribute when you initialze the colorbox plugin.
$("a").colorbox({photo:true});
Screenshot:

Is there any way to open ppt file open in Full screen when I click on anchor link in HTML?

I have ppt file in the href attribute of an anchor tag.If i click on the Anchor tag the file should open in Full screen.I tried by saving the ppt file in different Formats but nothing worked. Please let me know if any way to do that in Html or using Javascript.
Ppt is not an HTML standard so you can't expect to see it in the web page properly, but only if you have a proper viewer installed in the computer, but you can't predict it's behaviour.
Why not export the ppt to HTML and then point a link to it with target="_blank"?
Upload your PowerPoint to Scribd and you can use their API to show it on your website without any add-ons or special software.

Categories