Resize images

Prev Next

Image Resizer/Rotator offers four ways to resize. Pick one per button; you can create several buttons if users need different options.

Method

Parameters

Example

Exact dimensions

width and/or height (pixels)

width=800 makes every image 800 px wide with the height scaled to match

Percentage

rsrate

rsrate=50 halves each side; rsrate=150 makes each side 2.5 times larger

Target file size

rsfilesize + fsunit

rsfilesize=250&fsunit=KB makes each image 250 KB or smaller

File size reduction

fsrate

fsrate=50 aims for about half the original file size

If a button supplies more than one method, only the first one in this order is used: rsrate, width/height, rsfilesize, fsrate.

How each method works

  • Exact dimensions—with only width or only height, the other side is calculated to keep the image's proportions. With both, the image is resized to exactly that width and height, which can stretch it if the proportions differ.

  • Percentage—rsrate is how much to change each side by, not the final size. From 1 to 99 it shrinks each side by that percentage (25 → 75% of the original; 50 → 50%). Over 100 it enlarges each side by that percentage (150 → 250% of the original). 100 is not valid. Halving each side makes the image about a quarter of its original pixel count, but the file size doesn't change by an exact amount.

  • Target file size—the image is compressed and, if needed, scaled down until it's at or under the target, favoring the best-looking result. fsunit is KB or MB; without it the value is read as bytes. Decimals are allowed (2.5). The smallest target is 1 KB.

  • File size reduction—works like a target file size, where the target is the original size reduced by fsrate percent (1–99).

Important

Target file size and file size reduction work best on JPEG images, which are compressed to reach the target. Other formats, such as PNG or GIF, are made smaller by reducing the number of colors (from 256 down to as few as 8) while also scaling the image down. Photos saved in those formats can look banded or posterized afterwards. For photos, use JPEG images with these methods, or resize by dimensions or percentage instead.

If an image can't be made as small as requested, it's saved at the smallest size that could be reached and the result message includes a note—see User interface.

Set up a resize button

  1. Create the input fields on the table that has the images. Users enter the resize values here, and the button reads them:

    • Exact dimensions: two Numeric or Text fields, for example New Width and New Height.

    • Percentage: one field, for example Resize Rate. A Text - Multiple Choice field with values such as 25, 50, and 75 keeps entries valid.

    • Target file size or file size reduction: no input field is needed if the value is fixed in the formula. Add a field if users should choose it.

    One set of input fields applies to every image the button processes. To size images differently, create a button per image, each with its own fields.

  2. Create the button. Add a Formula - Text field with Allow some HTML tags selected, and enter a formula like one of the following. Replace https://... with your designated Image Resizer/Rotator server URL and Q# with your Client ID.

  3. Add the button to the form and, optionally, add fields to track results—see Track and store results.

Example: exact dimensions

Resizes the images in fields 14 and 15 to the values in New Width and New Height:

var text url = "https://.../ImageResizer.aspx?"  // your Image Resizer/Rotator server URL
& "clientid=Q#"  // your Client ID
& "&appid=" & AppID()
& "&dbid=" & Dbid()
& "&recid=" & [Record ID#]
& "&clist=14.15"  // file attachment fields to resize
& "&width=" & [New Width]
& "&height=" & [New Height];

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

Example: percentage

Replace the width and height lines with:

& "&rsrate=" & [Resize Rate];

Example: target file size

Makes each image 250 KB or smaller. Replace the width and height lines with:

& "&rsfilesize=250"
& "&fsunit=KB";

Example: file size reduction

Makes each image about half its file size. Replace the width and height lines with:

& "&fsrate=50";

Note

The button's POSTTempToken class and data-temptokendbid value let Quickbase confirm the user has access to the record when your account uses Quickbase enhanced security. Keep them as shown. To change the window size, edit data-height and data-width. See Configure pop-ups.

For every parameter, see Formula URL parameters.