Process images stored in Amazon S3

Prev Next

Image Resizer/Rotator can resize or rotate images stored in your Amazon S3 bucket instead of in Quickbase file attachment fields. The record holds each image's S3 object key and file name; the processed image is written back to the same key in the same bucket, replacing the original.

Before you start: Amazon S3 credentials

Image Resizer/Rotator connects to Amazon S3 with the access key ID, secret access key, region, and default bucket saved with your Quickbase Extensions account. Image Resizer/Rotator's own setup in the installation wizard has no Amazon S3 step, so the wizard doesn't save these for you.

  • The access key ID and the region always come from your saved credentials. There are no parameters for them.

  • Two parameters can override the saved values for one button: s3bucket (use a different bucket) and s3secretaccesskey (use a different secret key).

  • If your account has no Amazon S3 credentials saved yet, submit a technical support case. If you rotate the access key later, a Client Admin can update the saved keys in the Extensions Portal—see Update your access key after setup.

To create the bucket and an IAM user with an access key in AWS, follow Step 1: Create a bucket and Step 2: Create an IAM user and access key in Amazon S3 setup.

Important

Don't put your secret access key in a formula with s3secretaccesskey. Anyone who can view the formula field, or the link the button builds, can read the secret and use it to reach your bucket. Use your saved credentials instead.

Step 1: Create the fields

For each image, create two Text fields on the record:

  • S3 Key—the image's full object key (its path in the bucket), for example projects/1042/site_photo_08_14.jpg. It must match the object exactly.

  • File Name—the name to use for the file, for example site_photo_08_14.jpg. It's saved with the object as its file name.

To rotate, also create a rotation field per image—see Rotate images.

Step 2: Create the button

S3 buttons process one record (recid) and use these parameters:

Parameter

Value

amazons3

y

s3list

FIDs of the S3 Key fields, separated by periods

fnlist

FIDs of the File Name fields, one per S3 Key field

rslist (resize)

Resize percentages—values, not FIDs—one per image. Same meaning as rsrate: 50 halves each side. Whole numbers only, with no % sign (50, not 50%).

rtlist (rotate)

FIDs of the rotation fields, one per image. rotateval isn't used for S3 images; the rotation always comes from these fields.

s3bucket (optional)

A bucket to use instead of your default bucket

One of rslist or rtlist is required; otherwise the result reads Error - Please supply a resize/rotate list.

Give s3list, fnlist, and rslist or rtlist the same number of entries, in the same order. Unlike the file attachment lists, these aren't checked before processing starts: if one is shorter than s3list, the request stops partway with We ran into an error processing your request. Please contact support if this continues to happen., and images earlier in the list may already have been processed.

Example: resize

Resizes the image whose key is in field 119 to half its size:

var text url = "https://.../ImageResizer.aspx?"  // your Image Resizer/Rotator server URL
& "clientid=Q#"  // your Client ID
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&amazons3=y"
& "&s3list=119"  // S3 Key field
& "&fnlist=120"  // File Name field
& "&rslist=50";

"<a class='Vibrant Success OpenAsPopup POSTTempToken' data-height=400 data-width=800 data-refresh=true data-temptokendbid='" & Dbid() & "' href=\"" & $url & "\">Resize S3 Image</a>"

Example: rotate

Use the RotateImage.aspx address and replace rslist with rtlist:

var text url = "https://.../RotateImage.aspx?"  // your Image Resizer/Rotator server URL
& "clientid=Q#"
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&amazons3=y"
& "&s3list=119"
& "&fnlist=120"
& "&rtlist=130";  // rotation field

"<a class='Vibrant Success OpenAsPopup POSTTempToken' data-height=400 data-width=800 data-refresh=true data-temptokendbid='" & Dbid() & "' href=\"" & $url & "\">Rotate S3 Image</a>"

The same parameters work in batch processing arguments and API requests. Images in S3 can be up to 2 GB. For the messages S3 requests can show, see Image Resizer/Rotator messages and troubleshooting.