ZWeb.Forms.PhotosController (Portico/Z v0.1.0)
Upload and retrieve photo information, for Photo IDs.
See the ID Photo Process guide for more details.
Link to this section Summary
Functions
Upload an image file, and perform EXPLO's default photo ID transformation on it.
Show a photo ID form for people to fill out.
Return photo info from an id
, with optional transformation.
Link to this section Functions
create(conn, map)
Upload an image file, and perform EXPLO's default photo ID transformation on it.
Expects the request body to contain the following data:
file
- The actual photo file you're uploadingentity_id
- probably participant_uuid or similar identifiername
- name of the humanredirect_url
- (optional) - URL for redirection on successful post.
On success, returns JSON in the same format as show/2
.
new(conn, map)
Show a photo ID form for people to fill out.
Expects the request query to contain a data
parameter that is encoded using
Utility.Text.url_conceal/1
format (base 64-encoded JSON), with
the following structure:
{
"entity_id" : "probably participant_uuid",
"name" : "Participant Name",
"redirect_url" : "(optional) url for redirect when upload is successful"
}
If the query does not include the proper format, an error is thrown.
show(conn, params)
Return photo info from an id
, with optional transformation.
The id
in question is the public_id
of the photo resource (in
2021, that's the Cloudinary public ID).
On success, returns JSON in the following format:
{
"public_id" : "id",
"url" : "https://res.cloudinary.com/etc",
"resource" : {...}
}
...where the resource
key is a JSON blob that looks like the
result of Z.Photos.get_photo/1
.
Parameters
transformation
(optional String) - any transformation option fromZ.Photos.transformation_url/2
. If this is passed, theurl
key of the response will be updated with a URL to the transformed photo.