Tutorial: Images
DUE Wed, 11/5, 2 pm
This assignment may be completed individually or in team of at most 2. You can partner differently for each tutorial.
For this iteration of Chatter, we’ll add still and moving images to the app.
The course backend server mada.eecs.umich.edu is not available
for this tutorial.
Expected behavior
Posting a new chatt with image and/or video:
DISCLAIMER: the video demo shows you one aspect of the app’s behavior. It is not a substitute for the spec. If there are any discrepancies between the demo and the spec, please follow the spec. The spec is the single source of truth. If the spec is ambiguous, please consult the teaching staff for clarification.
Objectives
Frontend:
- How to access photo gallery album
- How to access camera and add captured photo and recorded video to chatt
- How to upload large binary data as
multipart/form-data, using a new 3rd-party library, AlamoFire, in the case of iOS. - Also for iOS: learn interoperability with UIKit, using UIKit’s
UIImagePickerControllerto add and manipulate images and videos - For Android: learn ExoPlayer and interoparability with Android Views’s explicit Intent.
Backend:
- How to parse
multipart/form-data - How to set up directory to serve static files
- How to save uploaded data to static files
APIs and protocol handshakes
To support posting and retrieving image and/or video clip, we add two APIs to Chatter.
The first is a modified getchatts API that accommodates image and video URLs:
getimages: uses HTTP GET to query the database and return all postedchatts, with optional image and video URLs, as described below.postimages: uses HTTP POST to post achattwith optional image and video data sent not as JSON but asmultipart/form-data.
Using this syntax:
url-endpoint
-> request: data sent to Server
<- response: data sent to Client
The protocol handshake consist of:
/getimages
-> HTTP GET {}
<- [ array of chatts with optional image and video URLs ] 200 OK
/postimages
-> HTTP POST <username, message, optional image, optional video> // multipart/form-data
<- {} 200 OK
Modified Chatter API data formats
As in the previous lab, the chatts retrieval API will send back all accumulated chatts in the form of a JSON array of string arrays. In addition to the three elements "username", "message", and "timestamp", each string array now carries two additional elements which are the URLs where the image and video data are stored on the server. If there is no image or video URL, the corresponding
value must be JSON NULL.
[
["username0", "message0", "id0", "timestamp0", "imageurl0", "videourl0"],
["username1", "message1", "id1", "timestamp1", "imageurl1", "videourl1"],
...
]
To post a chatt, the client sends a multipart/form-data with fields "username", "message", "image", and "video". The value of each key is a string (not urls!). If a chatt carries no image and/or video, since we’re using multipart/form-data encoding instead of JSON, the key "image" and/or "video" may be omitted or their values may be set to the empty string ("") or null.
In terms of testing, unfortunately there’s no practical way to attach sample image and video without a working frontend. Postman, or other REST API client, however, can play back images and videos retrieved with getimages.
Assignment specs
You must first upgrade one of the alternative back-end servers:
then one of the front ends:
| Prepared for EECS 441 by Sugih Jamin | Last updated: August 29th, 2025 |