How to handle downloads in mobile site - asp.net-mvc-3

How does one handle image downloads in a mobi site - using jquery mobile and asp.net mvc 3 and have a requirement to allow a user to download wallpapers to their mobile.
Can you trigger a download or is best to simply simple the image to them and let them handle the saving?
Any input appreciated.

Typically, you can force the download of content on standard browsers by setting headers
"Content-Disposition", "attachment; filename=\"LicenseAgreement.pdf\""
on the return. This SO shows how to return a PDF file but theoretically, you could do the same with an image.
How can I present a file for download from an MVC controller?
However, it is questionable if every browser that is supported by jquery mobile would even respect that and give any kind of a save prompt or just open the image in a new window. Give it a shot but test it on iOS, Android, WinPhone 7.5+, and (gagging) Blackberry 6+ and see what happens because they're probably going to all behave a little differently.
Were it me, I'd simply link directly to the image either on the current page or with a target="_blank" and let them save it however they usually save images.

Related

phone inappbrowser doesn't start from full-zoomed-out when it loads huge image

I have a window.open code to launch inappbrowser on phonegap. I use it for displaying image.
This inappbrowser has EnableViewPortScale=yes, so it's totally zoomable.
However, it seems like there is zoom-out-limit in inappbrowser. Here is the code.
window.open(myFullImageUrl, '_blank',
'location=no,EnableViewPortScale=yes,presentationstyle=pagesheet');
It's already zoomed-in a little. I can zoom-in-and-out because of EnableViewPortScale=yes for sure.
However, it seems like there is zoom-out-limit.
when i load up 1024x768 photo, it doesn't show fully zoomed-out photo(on both iOS and Android), but it's like 120%-ish already zoomed in.
I Just created stackoverflow account, so i can't upload photo. sorry!(it says i need 10 reputations to upload image)
There is no true solution for this issue.
So what I did is I just continue using inAppBrowser, but just instead of directly loading image from Amazon server(that's where I stored all images), I just made my window.open to go to another my URL and attach that url as a parameter after '?'.
The reason why I did this is because then I can force the Image web-view to have brief Javascript and CSS to render this dang-image correctly.
And as you guys know, this page must have meta-data that allows user-scale true, and must NOT have max-scale value.
So, Yep. Long story short, If you DIRECTLY load up the image in the inAppBrowser of phonegap, there is NO WAY you can force the image to start with 'not even slightly zoomed-in, but perfectly zoomed-out to the max'. Your own Page, Your own JS and CSS is the way to go guys.

How to make screenshots on chromecast?

I would like to make screenshots of the receiver application running of the Chromecast device.
I need to have it running on the device to show the video and the application together.
Is there a way to do this ?
Ali Naddaf's answer is technically true, however with a little work I was able to make a faithful reconstruction of the screen, to the point that it is indistinguishable from an actual screenshot.
We will use code from the html2canvas project, see http://html2canvas.hertzen.com/documentation.html . It will render our screen to a canvas. In particular, copy&paste the compiled code from http://html2canvas.hertzen.com/build/html2canvas.js to the Chromecast console. (adding a tag to dom seems not to work) You can access the Chromecast console & developer tools by accessing the ip.ad.dr.ss:9222 port via Chrome.
Issue the following command:
html2canvas(document.body, {onrendered: function(canvas){document.write('');}});
This will destructively replace the screen with the screenshot (I find this convenient but you can easily think of a more polite way if you wish)
In the elements browser, you will have an img, with a base64 url specified as a src. Click on the url, chrome will open the image in a new tab. Hopefully it's the screenshot that you wanted.
You might find that some pictures are missing because of e.g. same origin policy. The javascript have other privileges than accessing images from html. If this happens, work it out somehow (use https for images for example), then goto 1.
You have your screenshot!
No, that is not possible due to many reasons such as media rights and security.
I'm extending zsolt-szatmari's answer into a copy-pastable script that you can use in the Chromecast Developer Tools console:
As he said, copy and paste http://html2canvas.hertzen.com/build/html2canvas.js code into the console
Call the html2canvas method: it will create a new canvas element into the DOM: html2canvas(document.body, { onrendered: function(canvas) { document.body.appendChild(canvas); } });.
Get a base64 string representation of the image currently displayed in the canvas: document.getElementsByTagName('canvas')[0].toDataURL('image/png');
You'll then get a very long base64 string: if you click on it, Chrome will show the image in a new tab. Please note that this image could be far from what is really shown on your Chromecast due to html2canvas limits:
The screenshot is based on the DOM and as such may not be 100%
accurate to the real representation as it does not make an actual
screenshot, but builds the screenshot based on the information
available on the page.
(source)
I was thinking that you could maybe use this to capture the canvas to an image file, which normally works in javascript with canvas:
var canvas = document.getElementById("mycanvas");
var img = canvas.toDataURL("image/png");
Of course then you would need to transfer this image file to somewhere - not exactly sure how to the last bit from the chromecast. Maybe that is not possible.
As a chromecast developer myself I needed screenshots of the app running to show customers. I ended up doing a kind of "simulation" of the chromecast - calling some mockup methods in javascript to display the data and then accessing my receiver app via the cast url on my desktop in the browser. Then I used a screen capture program to capture the browser output. This gave me the same screenshot as from running the receiver app on chromecast on TV, which is essentially just a browser showing your html+css+javascript receiver.

How to save screen shot of a web page?

I want to save screen shot of a web page.But I don't know how.Just like the app delish.In delish ,when i add a bookmark ,the app capture the website and save it such as p5.delish.I guess the screenshot comes from the file of the ".delish".How can i produce this file? or some one has some samples like this app? Thanke you very much!
This might help you: http://allseeing-i.com/ASIWebThumbnail/
ASIWebThumbnail is:
A command line tool for generating thumbnails from web pages
An API to use an embedded version of the tool in your Cocoa applications
ASIWebThumbnail uses the WebKit framework built-in Mac OS X to render web pages. As such, it should support any content that WebKit supports, including HTML/XML + CSS, SVG, content rendered by Javascript (Canvas, AJAX, DOM etc), Java, as well as Flash and other plugins.

How to capature the image in a Table in MVC3 (Razor)

i have develop a MVC3 application in that i want capture the Image, that image i have set a table td baground. When i click the Button then i want capture that image .Is it possible in MVC3 ? If possible please help me .
td's are html. They are rendered by a browser, not the server.
Browsers do not have facilities to save the content they render as images. The server doesn't know anything about how it's rendered. It just sends text to the browser.
There is no way, short of an activex control of some sort (which won't work in FF, Chrome, Safari, Opera, etc..) to render the iamge people see.
You could render an image on the server side.. but it would not, necessarily, be identical to what the end users sees because each browser reders html a little differently. It would be hackish, and would require that you dig into the guts of the framework. In any event, it would be a lot of work. So, ask yourself, is months of coding really worth it for this feature?
Is there any way convert My Mvc Viepage in to Image when click on button it needs to convert entire Mymvc view page to imge and save it .

WebView PDF Page Jump

I have a WebView that displays a local pdf file. The file is 230 pages long and loads fine etc. I need a way for the user to jump to a specific page if I can. For instance if they look at the table of contents of the pdf and they want to jump to page 120, they can do it? Any ideas on getting this done?
You're asking questions about using the Cocoa Touch APIs in the iPhone SDK, but you're tagging them "Xcode." Xcode is the development tool, not the platform or the API; you will probably find a better audience for your questions if you add the "iphone-sdk" or "cocoa-touch" tags.

Resources