🚀 [HELP!] TinyPNG & Baserow: My Scenario Works, But the Files Are Still Chunky! (And My Make Credits Are Gone)

I am attempting to create an automatic image compression flow: taking user uploads from Baserow, running them through TinyPNG, and saving the compressed file back to a second Baserow field.

The good news is, the scenario runs end-to-end! The bad news is, it doesn’t work.

  • Original File Size: 313 KB

  • Compressed File Size: 313 KB (Same!) (Note: When run manually on the TinyPNG website, the file compresses beautifully to ~100 KB.)

I’ve been in a multi-day debugging war, harassing Gemini and ChatGPT, and the solution has evolved into a ridiculous 8-module chain. I’ve burned through my monthly credits just testing the fixes, so I’m pleading with the community for the one true answer!

Here is the not really working setup:

I can’t even begin to explain the convoluted kerfuffle these AI chatbots were making me do! :rofl: Add this, delete that, the setting in the array aggregator isn’t even there…then there’s this:

{{ '{"field_NUMBERHERE": [ {"name": "compressed_' + 14.id + '.png", "base64_content": "' + toString(50.Data; 'base64') + '"} ]}' }}

Why, because I was thinking that if the file names of the original and the compressed are the EXACT same, the compressed images were just being overwritten by the original?

Confused Pokemon GIF

:purple_heart:

Hey there,

yeah as a first step, stop asking LLMs on how Make works. They are clueless and cause more problems than they solve.

Second - what are you iterating and then aggregating? Can you show some output bundles so we can see what each module is producing and what the final output should be?

On the surface, from the explanation it sounds like you need to ditch the iterator module and change the source of the aggregator to the Watch module.

Good ol’ Google told me I would need an iterator and an aggregator since I have more than one image in my file field to be Tinified. I would need those two because it would need to send the image URLs as an array….because multiple images?

Here is the TL;DR version of what the AI told me it was for (because I really don’t know).

The primary job of the Iterator in your scenario is to break up the file field array from Baserow.

When you use the “Watch Rows” or “Get a Row” module in Make, the “Original Files” field doesn’t just contain one file; it contains a list (or an array) of file objects. Even if the user only uploaded one image, Baserow treats it as an array of length one.

It ensures that if a user uploads five files, the compression process runs five times, once for each file.

The Aggregator’s job is to take all those individual file results created by the Iterator and repackage them into a single, structured list that the Baserow API can understand.

One of the issues I was having that me and the Ai were arguing about was that for the Baserow…update a row, my file fields (the ones I needed) where not present. ALL other fields were there, available for mapping (including my linked fields). So it was trying to make me do an HTTP request instead.

The AI was also trying to get me to MAP the array aggregator fields, but there was absolutely NO place to “map” anything and the “custom” option was grayed out, so it made me use the text aggregator.

  1. So I have watch rows, to see if any file has been uploaded to the file field.
  2. I have get a row.
    ”The primary reason you needed a Baserow - Get a Row module is to retrieve the necessary full data structure and IDs required for the final update, especially when dealing with triggers.”
  3. Iterator to break up the field array
  4. Tinify to make files smaller
  5. Aggregator to smash all the URLs back together
  6. HTTP request to send the (not actually) tinified URLs back into Baserow.

Here are some screenshots. I dont think it exposes any sensitive data, but if it does….:woman_shrugging:

Your scenario might need to look more like this instead.

Upload each compressed file to baserow separately

Hope this helps! If you are still having trouble, please provide more details.

— @samliew

I thought that too, but I think the upload file is only for avatars or something? It wants an email and name only. Nothing about fields and what not.

According to Image upload via API in File-Field - #2 by bram - Technical Help - Baserow, you will need to upload to the user files first.

Perhaps try filling in those fields to see if more fields appear?

If not, you can always use the universal module.

Hope this helps! If you are still having trouble, please provide more details.

— @samliew

Hope this helps!

Not at all, but thanks anyway! I’ll try Zapier and see if that’s better and/or easier.

Thanks,

D

Hey @DEKO - not sure if you still need help with this or not; I’ll send this anyway in case it helps someone else in the future. (Or maybe you’re still around :green_heart: )

You had the right idea and I don’t blame you or the AIs for getting lost here - Baserow doesn’t have the best API documentation for file uploads.

Here’s what we’re going to set up:

And here’s a copy of the scenario if you want to just add it to your account:


1. Baserow - Watch Rows

This should already be working fine for you; just map the Baserow Table ID you’re watching for new rows.

2. Iterator

Here, map the field (array) that contains your files from the Watch module, for example:

3. Tinify - Compress an image

Select URL as the Image Source and map the url from the iterator:

4. Baserow - Make an API Call

Next, find the Baserow module “Make an API Call” and add it after Tinify:

We’ll use this module to upload files from Tinify to Baserow, “somewhere”.

Configure it like this:

  • URL: /api/user-files/upload-via-url/
  • Method: POST
  • Body: { "url": "{{downloadUrl}}" } – replace {{downloadURL}} with the variable from Tinify

5. Array Aggregator

Add an array aggregator to collect all uploaded files into one bundle. Configure it like this:

  • Source Module: Iterator
  • Aggregated fields: body (from last Baserow module)

6. Baserow - Make an API Call (last one!)

Last module we’ll add is another “make an API call” module for Baserow, and configure it like this:

  • URL: /api/database/rows/table/{{TABLE_ID}}/{{1.id}}/

    Here, {{TABLE_ID}} is the ID of the table you’re updating rows in, and {{1.id}} is the ID of the row you’re updating.

    Since you mentioned you’re wanting to update the same row that triggered the “Watch Rows” module, you can just map the “Row ID” variable from the first (trigger) Baserow module here.

  • Method: PATCH

  • Body:

{
  "field_ID": [{{map(15.array; "body")}}]
}

What you’ll want to do here is:

  1. Replace “ID” with your file upload field’s ID, you can get the ID from the column in Baserow:

    So in my case above, “field_ID” would be “field_6351215”

  2. Then, add square brackets [ ] and write the map() formula inside. You want to map “body” variable from the previous array aggregator

    [{{map(15.array; "body")}}] << you can copy-paste this, you’ll just need to re-map the array variable to your own

It should look like this when finished:


Note that this will replace ALL files in the selected row’s “file upload” field, with the files from this scenario.

So if you’re only uploading images and stuff that Tiny can handle, you’ll be fine - but if you expect to upload e.g. SVG or PDF files in this field, it might be better to use a separate file upload column for Tiny’s compressed files. Call it “compressed” or something like that, and change the last module “field_ID” to that new column’s ID instead of the original one.

Cheers!
Sierra