What's the image upload flow for websites with CDN - file-upload

I'm preparing for system design interviews and can't seem to find an answer to the question below -
What happens when a user uploads an image to Facebook (or any other platform that uses CDN, such as Twitter, WhatsApp, or other social media platforms)?
Let's assume
Facebook's origin server is in California, US
user_a is in India.
This user must be connected to a CDN network edge server, which is providing all serving requests to this user on behalf of Facebook's origin server.
What occurs when user a uploads an image? -
Will the upload request be sent to the core server, where it will be propagated to the CDN network, and the CDN URL will be returned to user_a to be cached in the user_a's browser?
Upload will take place at the CDN edge server, and the user will be given the cdn url (which user_a's browser can cache), and CDN can submit this image to FB's core server.

Related

Most efficient way to send image to frontend

I have images stored in Google Cloud Storage. Whenever my frontend (Swift) requests a certain image I would like to send the image as quickly and efficiently as possible from my backend.
Conveniently, Google Cloud Storage has direct image links for every image.
Is it most efficient to send a multipart/form-data the same way I send an image captured by a user in the front end to the backend? Or is it more efficient to send the URL of the image stored in the cloud where the frontend can proceed to download the image from that URL?
This can indeed be done through a signed URL which provides limited permission and time to make a request. With signed URLs authentication information is contained in their query string, allowing users without credentials to perform specific actions on a resource.
I would like to point out however that Signed URLs can only be used to access resources in Cloud Storage through XML API endpoints.
Since you are using Swift for your frontend I would also like to direct you to explore Google APIs for iOS, such as CocoaPods.

Migrate videos from Vimeo to S3

I have a large quantity of videos on my Vimeo account that I would like to migrate to my AWS S3 account.
Rather than go through the time consuming process of downloading from Vimeo to my local machine then uploading from my local machine to S3, is there a way where I can do a direct transfer from Vimeo to S3?
If possible, I would want to create a script to iterate through each video via Vimeo API and set up the path to where it would go into S3 then initiate a direct transfer. Any ideas or suggestions would be much appreciated!
If you have a PRO account or higher, you can use the API to get download links for videos on your account, including download links for the original source file. Those download file links should be able to be used for importing into S3. Note that the links provided via the Vimeo API are expiring HTTP 302 redirects to the video file resource, so make sure you take note of the expiration time also provided in the response.
Download links are returned with the rest of a video's metadata, so I suggest using the fields parameter to only return the metadata needed.
http://developer.vimeo.com/api/common-formats#json-filter
https://developer.vimeo.com/api/reference/videos#GET/users/{user_id}/videos

Does Google Track Machine ID when uploading images to Google+ profile?

Does Google Track Machine ID when uploading images to Google+ profile?
wondering if simply using proxies and clearing browser cache (and not use chrome) is enough to keep google profiles completely separate from one another
is there an app for that?

Google drive API and auth

I want to create a web app letting any user upload a file to my Google drive and then be able to view it through the browser.
So far looking at Google's examples it seems I have to auth to my Google Drive on the server side (makes sense....) but also end-users have to auth before uploading anything to my drive using Oauth. Is there a way to prevent having to ask users to authenticate prior to uploading documents given that I am authorized through my server to my Google Drive account?
Allowing anyone to view a document is more straightforward through the use of a public folder...

Rails Paperclip Phonegap Heroku S3- How to return image files from an Ajax request through the controller?

I am creating a mobile app through Phonegap as the client and using Rails as the back-end. I am deploying my app to Heroku and am planning to use S3 to store the image files, because that is what is recommended from my various readings online.
I was wondering how could the Rails controller be used to send images back from Ajax requests from Phonegap.
I am not sure how to write the back-end API code to send images to requests.
I also read that using the send_file method without x-send_file enabled will slow down the server because sending the image would block other request until it is done.
Please let me know if you have any insights.
You could use redirects to the S3 assets here, then your browser is just getting the image directly, and not holding up one of your server processes while the browser slowly downloads the images.
If you need to keep your images private you can use the signed URL feature of S3 to only give signed and time limited URL's to the appropriate users. (See my commit to Paperclip: https://github.com/thoughtbot/paperclip/pull/292)