I'm working on a project at the moment which involves taking a lot of images on mobile phones and loading these into an app based on Knack. I quickly realised that the sheer volume of data being uploaded to the database would render the app uneconomic and tried to find a way to reduce the size of the files.
My first stop was to see whether the camera app could be set to record lower res images - but certainly on iOS this doesn't seem possible. This lead me to try to find a way to resize the images within the database after upload. Initial attempts to do this with Zapier failed (for a start Zapier cannot update an existing record in Knack) - a little searching later and I found Integromat.
Wow! This product has a fantastic user interface! My next discovery is that you get all of the features - even with a free account! This is great for consultants who need all the features but rarely actually use apps live!
Pricing is broadly in line with Zapier but is more based on usage - in this case data volumes and 'operations'.
In this post, I'm just going to go through the process of configuring Integromat to trigger on a new record in Knack, fetch the image, resize it and save it back - but there's little more work required if you want to save a copy in Google Drive - or whatever.
Integromat uses the term Scenario when referring to the processes you create - in this case, I am going to connect to a Knack app called 'Test App' and a Table 'Images'. Note that you need an Auto Increment field in the table in order to trigger Scenarios (to keep track of where it is).
In this table, I have manually loaded a single record with an 11MB photo of some fishing nets - the database size is over 16MB:
Clearly, with this kind of file sizes our data allowance would soon disappear!
The first step in building the Scenario is to select the trigger app (Knack) and configure it. You can see the options for Knack below:
Note that with Knack, you need a connection for each database you link to - they're simple to set up.
Running the Scenario with just this one step allows you to check that you've got the data you need - notice the URL for the photo:
Clicking on the 'connector' on the right of the module allows you to link to and create another - in this case, I discovered that I needed to use the HTTP module to actually retrieve the photo from Knack - the record from Knack only included a link:
We now have the image in Integromat and can use their Image module to resize it:
Having now resized the image all we have to do is to upload the re-sized file and then update the original Knack record with the newly resized photo:
So this is the completed Scenario - when I tried this is couldn't believe how easy this was!
Back to the Database…
Back in Knack, as you can see below, we now have a much smaller image:
And if we compact the database (remove unused assets) then the database size reduces to 5MB - a reduction of 11MB in this case!
This is only my first foray into Integromat but I think it shows that there is quite a lot of promise here. I intend to write further blog posts about it once I have more exposure.
There is one thing I noted which is that Integromat works well with most apps I've tried so far - except for Airtable. Although there is an Airtable module this leaves a lot to be desired and I wouldn't recommend it at the moment. Integromat informed me that Airtable haven't given them access to their "Private API" which is used for other similar products - I can't confirm this but it sounds simple to sort out given a little will on both sides.
For more information about Integromat click here.