Compress an image to a target size in KB

Set a file size limit for a form or attachment. Download a JPEG that fits the limit, with the final file size shown before download.