image attachment from camera or photo library MFmessage/MailcomposeViewController - ios

Am wondering if i can attach an image to my SMSComposerSheet (like the message application in the iPhone does). I've already implemented image picking (from library and camera)
So may be i need some thing to add in the displaySMSComposerSheet method to allow That.
One other thing, i want to do the same thing with mails sending, but i think that i couldn't, so i was thinking about saving the image into the application's sandbox then attach it to the mail. but i don't know how to do that :s
Thanks in advance

To try use this https://agilewarrior.wordpress.com/2012/02/08/how-to-attach-an-image-from-your-photo-gallery-and-send-it-as-an-image-on-iphone/

Related

Replace existing images to Photo Album

I am using UIImageWriteToSavedPhotosAlbum() method to save images in photo library.I am calling webservices to get images and saving it in photo library but It is creating copy of images because webservice is calling no. of time.
How can I replace existing images from Photo Library?
Thanks
No you can not, since this will allow you to update user images with their consent.
Apple is very restrictive about these kind of things, just image you are overwriting all the images by adding some banner. There is noway the user can undo this.

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.

ALAsset Unique identifier

I want to duplicate an image from the Photo Library but I want to check in the future if I already have imported this image.
Immagine this scenario.
I have a photo in my Photo Library.
I import it in my app by making a copy of it.
I remove this photo from my library.
At a later time I reinsert this picture to my photo library (Same photo from iPhoto, just didn't synch it's album before and I have now)
Is there a unique identifier that I can use to compare the two pictures? is the URL unique?
Or do I have to look into the metadata and try to match it?
If so, what would you suggest? Created Data and location? Just created Date? Size?
Thanks for your advice.
Observations
I've been working with similar functionality, so this is what I know:
Each photo inserted into the photo library will have a unique URL (this means if you insert an image, delete it, then insert it again, even if it is the same image, it will have a new URL).
There is no straight forward way of knowing whether an image is a duplicate of a previous image or not.
I don't think you are trying to do this, but I will warn you that you cannot delete an image programmatically from the iPhone Photo library.
Solutions
I really only have one way of handling this: Create a hash of the photo and store the hash somewhere. If the photo inserted is the exact same photo as before, it should give you the same hash. You can use that hash comparison to determine if you are using the same photo or not. This is the method that I am using and it seems to work reliably for the most part. I have noticed some discrepancies, but these usually involve my work hashing the files before they are added to the photo library (I have noticed that the saved photo can be different from the photo that is being saved).
I hope this information helps. Let me know if I've missed anything or you notice different results in your work.

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