What is the storage path for setting blackberry wallpaper? - blackberry

I know I have to use this code: HomeScreen.setBackgroundImage(Sring uri) to set the wallpaper from an image in my app, but what would I type for the string url? I have the image in my app and as of yet I am not using persistent storage. So question #2 is, do I have to put the image in persistent in order to use it as the wallpaper?

Check this link, setBackgroundImage, it describes typical format of an URI.
Sets the background image for the home screen. Must be an image file
residing in flash memory or SD Card. Typical format for the URI would
be "file:///store/home/user/pictures/file.jpg".

Related

Generate file-directory-safe string using URL?

My app is sent messages which sometimes include http links to images. When this happens, I want to cache the image locally, so I can display the image in future without needing to download it, if it exists locally.
But lets say the image url is http://imgur.com/abcdef.jpg. A file path of something like this, I'd imagine could have all sorts of issues:
/var/Applications/[application]/documents/http://imgur.com/abcdef.jpg
What I need is a way to take the given image URL and generate a file directory-friendly string, so that I can save the image using that URL every time, or check for its existence.
While there are many ways how to implement it (simpliest way would be to create MD5 of the web address, store image as [md5name.png] and then just try to check if md5 file reference exists), I suggest you use one of two libraries made for that:
https://github.com/Haneke/Haneke
https://github.com/rs/SDWebImage
They both work on url-based principles, provide you with all known implementations of caching and they handle cases like this by default. Both of them also download images in background which is recommended way to do it and have convenience methods to load images in UIImageView.
Hope it helps!

Where do Instagram/Facebook store images internally?

Like the title says. In an iPhone, in what directory do Instagram/Facebook (and similar applications) store the images they downloaded at runtime?
When is that directory wiped?
For non permanent images (e.g. post thumbnails but not user profile pics) I would imagine they get stored in the <Application_Home>/Library/Caches, other content probably goes in Documents
You don't need to know what facebook or instagram do, but If I understand your question right, you want to download images asynchronously from web and cache them. For that u can use a third party class to handle the caching instead of writing your own, I would suggest SDWebImage.

Should I store 1500 images in my app bundle?

I have about 1500 images that are used in my app, they are similar to clip art. I wanted to know what the best way to store these is, and the way to loop through that folder to list all of the image names and paths.
Is it best to store all images in my app bundle? If so, how do I then list all contents at that directory path?
Is there a better alternative to this?
As long as you stay under the size limits putting the images into your app bundle sounds like a valid choice.
You can use NSBundle's pathsForResourcesOfType:inDirectory: API to list paths for items with a specific extensions inside your bundle. If you adopt a naming scheme where a path name encodes the name that you want to give your image in the list, you can implement a simple method that extracts image name from a resource path name.

Best way to display non-public images in a rails view

I am trying to find the best way to render confidential images in a view, without storing the images within the rails application flat-filesystem, as I have no idea where to place the images. I am storing the image data binary as :text in a sqlite3 database table and successfully display the images using
<% s = "data:image/png;base64,#{ActiveSupport::Base64.encode64(#my_image)}"%>
<img style = 'width:100%; height:600px' src = '<%= s %>'/>
This works for me in Firefox and Chrome, but my client cannot get the images to display. I'll find out in an hour or two what browser they are using. Client says they want the image src url to look like a relative path within a controller's folder, which seems to contradict the notion of not storing the image in the flat-file system.
I think I am missing something very small here, but I would like to know the proper way to store images and documents in an application that are not public to all users. If my question is not clear or you need information, please let me know and I will provide more information.
I have read of attachment_fu and paperclip, but they appear to allow attachment downloads, and I just need to display an image inline on a page. Any help is greatly appreciated. Thank you much in advance.
You can keep files in non-public repositories and have controllers action with send_file(path, options = {}) It allows you store files somewhere on the hard disc and keep access logic inside your controller.
Have you tried the paperclip gem? You can upload images to amazon and amazon allows you to set permissions for files...if you want to do it that way.
As Artem says, Amazon is a great way to achieve this. But if I get you right, they want to see an URL to the image directly (i.e. be able to type the source into the address-field if they want to).
You need to decide wether everyone should be able to access the image (given they know the name/path), or to have authentication, in which case I don't think a relative path is worth anything.
Can't you just have an image-folder containing all images (not accessible by URL), and a table to lookup wether userX is allowed to see imageY?

Browse for an image on an iPad/iPhone from HTML5

I have an HTML5 application that allows users to drag-n-drop an image to a canvas, or alternatively, browse for it on their local disk. Once I got the image, I display it in the canvas using context.drawImage(). Got all the kinks out and it works great.
BUT. Now my customer want to use it on an iPad. Drag-n-drop is out of the question (the browser is a full window on iDevices). But the browse functionality, which is basically an input of type file, doesn't work either.
To clarify, the behavior I need is selecting an image from the gallery and displaying it in a canvas.
Any ideas on how I can achieve this?
Thanks for your time.
Unfortunately, there are no satisfying answers for this.
http://learnbythedrop.com/forum/iphoneipad-safari-image-upload-resrictions
Basically, mobile safari is pretty severely sandboxed – file uploads don't work, can't grab files from photos, etc.
With iOS 5 there may be a solution for this using iCloud. Content is stored and pushed to mobile devices. Perhaps you'll be able to access the image from your photo stream?
Alternately, you could use a service like photo bucket or flickr to store your images, then use the API to access them from your page.

Resources