Rotate images

Prev Next

Image Resizer/Rotator rotates images clockwise by 90, 180, or 270 degrees. Rotate buttons use the RotateImage.aspx address instead of ImageResizer.aspx.

There are two ways to choose how far to rotate:

  • One amount for every image—rotateval is 0, 90, 180, or 270. Use this to rotate all images on the button the same way.

  • An amount per image—in clist, follow each file attachment FID with a colon and the FID of a field holding that image's rotation. For example, clist=14:40.15:41 rotates the image in field 14 by the value in field 40, and the image in field 15 by the value in field 41.

If both are supplied, rotateval is used for every image. Both work for one record and for multiple records.

Set up rotation fields

For per-image rotation, create a Text - Multiple Choice field for each image, for example Rotate Options - Image 1. Give it these choices, and clear Allow users to create new choices so only valid values can be picked:

  • Do not rotate

  • 90 degrees

  • 180 degrees

  • 270 degrees

Rotation fields accept a number (90) or a number followed by degrees (90 degrees). Any other value, including Do not rotate or a blank field, leaves the image unrotated.

rotateval is stricter. It accepts 0, 90, 180, or 270, with or without degrees after the number (90 and 90 degrees both work). Anything else is an error:

  • Do not rotate (or any other text) gives Error - Rotating by a value other than 0, 90, 180, or 270 degrees. Use 0 for no rotation.

  • A blank value, when clist has no rotation fields, gives Error - No rotation amount was provided for field 14. Supply 'rotateval' or a per-file rotation FID via clist (e.g. clist=6:8). If rotateval reads from a field, make that field required or give it a default value.

For a rotateval field, use a Text - Multiple Choice field with the choices 0, 90, 180, and 270 (or 0 degrees, 90 degrees, and so on), not Do not rotate.

Create the button

Add a Formula - Text field with Allow some HTML tags selected. Replace https://... with your designated Image Resizer/Rotator server URL and Q# with your Client ID.

Example: per-image rotation

var text url = "https://.../RotateImage.aspx?"  // your Image Resizer/Rotator server URL
& "clientid=Q#"  // your Client ID
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&clist=14:40.15:41";  // image field : rotation field

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

Example: one amount for every image

var text url = "https://.../RotateImage.aspx?"  // your Image Resizer/Rotator server URL
& "clientid=Q#"  // your Client ID
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&clist=14.15"
& "&rotateval=" & [Rotate Value];  // 0, 90, 180, or 270

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

Add the button to the form. To keep the original image and save the rotated one elsewhere, or to record when images were rotated, see Track and store results. For every parameter, see Formula URL parameters.