Get an image from URL and upload it to Firebase Storage - ios

Is it possible to write a function to get an image from a url such as https://website.com/images/myImage.jpg and then automatically upload it to a Firebase Storage bucket?
I am trying to do it with multiple images in one go but am struggling to get one to work at the moment. My best attempt so far has seen me having to download the images, save them in the Media Library and then send them all up to Firebase, which surely cannot be the most efficient way?
In a nutshell, I have 10 images with URL's like the above and, when the function is fired I need them all to upload to my storage bucket, without the need to save them to the users device library.
Does anyone have any ideas on the most efficient way to do this please?

Related

Base 64 or Image file to upload for mobile apps IOS using swift

What is the latest sayings and professionals recommendations to use images for mobile apps. I'm very confused. Being a newbie in IOS development... there are always many directions before decision. Can somebody please recommend what kind of files type should I Use. Base64 encoding to directly store into DB or Images and upload them onto the server. if base64? what datatype do you guys recommend? i'm using BLOB is that fine?
This link says we should use base64
But many says. file size is very heigh in base64 than images (JPG or PNG)s.
It depends on the server, many of them have a "file" option with a callback containing the URL, then you just store the file and consume the URL. I really think that base64 is too much unnecessary processing.
The easiest one is Firebase Storage, where you can just put the file as image/jpeg and receive an URL to that image. Another option is Cloudinary, there are many options.
Most apps just download images from URL's and show them as demanded. You can store images anywhere you want, and in your DB you store URLs from them.

Upload to s3 from react-native CameraRoll

Considering using react-native-uploader to upload from iOS CameraRoll to s3. My end goal is to allow users to select an image from CameraRoll and post it on an api-based chat (sendbird). Based on the documentation, for react-native-uploader, though, it doesn't seem like it returns the s3 url in the response. Does anyone know if there's a way to get this back in the response? Perhaps I be approaching another way entirely?
Part of the rationale for this approach is that it's similar to how it works when a file is uploaded on the web-based version of the chat. We use file-uploader, then we post the message to sendbird using the s3 version of the url. Appreciate the help.
Ended up using react-native-aws3 instead. It was very straight forward.

Uploading pdf files stored in iphone to server in ios

I am making an iphone application which is pretty much like forum. People can ask question and upload a pdf/doc file along with the question. Is there a way to access the pdf/doc file in iphone when user clicks upload button and send the file to server?
I have implemented the feature for image for which I used UIImagePicker to pick the image and send it to the server with http request. But I am completely lost and have no idea how to handle pdf/doc files in same manner.
Any help/suggestion really appreciated. Thanks in advance.
If you want to upload PDF and Doc files, then you can integrate Dropbox and Google Drive in your app and then select the files ,as Apple does not have centralised storage. If you notice Apple also chooses the documents from Google Drive while composing a mail.
So implementing and integrating google drive and Dropbox would be a good option.
Here is the link for Dropbox https://www.dropbox.com/developers-v1/core/sdks/ios
Here is the link for Google Drive https://developers.google.com/drive/ios/quickstart
Implementing Google drive is a bit hard but dropbox is quite simple.
Wish it saves your time. All the best!
I think you are looking for a combination of two things (both have been discussed here before and I include the links below).
(1) store a PDF. There are many options but the best way is to allow coredata to save outside the persistent store. Then store the reference to the file in core date. See: Insert a PDF file into Core Data?
(2) send the file to the server. There are many options for this as well. The fastest is probably to use a wrapper library such as ASIHTTPRequest. See: File Upload to HTTP server in iphone programming

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.

Creating a Rails Music Player App (something like Rdio)

i want to create a rails app that has a lot of mixtapes, which the user can listen to and download (like datpiff.com). All the mixtapes would be uploaded by me. Each mixtape would have their own page, with the title, artist name, cover, etc.
I'm having trouble getting the architecture of the app right. What's the best way to upload all the mixtapes. (I'm thinking something like Amazon S3).
Do I have to upload a zipped file with the entire mixtape, and each individual song, or just the zipped file.
How do i show the information of each song (title, length, etc)
Ofcourse the biggest problem is the streaming of the mixtape, and the download of the file.
Can anyone guide me as to whats the best way to create this app. (Is Rails the best way to do it?)
Thanks in advance.
You're on the right track with S3. Use paperclip in conjunction with it if you want to make some sort of GUI for you to upload stuff with.
For streaming check out jPlayer, which is a jQuery plugin.
Download's no biggie. Check out Rails' send file. For sending from a remote source like S3, look here.

Resources