Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Nov 05, 2020 01:38 AM
I’m trying to read what are the width/height of a given image. The following JS code works fine outside Airtable:
const img = new Image();
img.onload = function() {
alert(this.width + 'x' + this.height);
}
img.src = 'http://www.google.com/intl/en_ALL/images/logo.gif';
But when writing an Airtable script, const img = new Image();
yields ReferenceError: Image is not defined
.
Is there another way to know what are the width/height of an image within an Airtable script?
May 12, 2021 12:43 AM
Hey @TFP !
Could you solve this problem? I am trying to achieve the same thing :slightly_smiling_face:
Thanks!
May 12, 2021 12:58 AM
@JJ_Velaz Yes, I did. But not using Airtable, I had to write an automation which calls my own API and used some Node.js code to resolve the width/height. Didn’t find any viable solution with Airtable alone.
May 12, 2021 05:01 AM
If you use cURL, the Airtable API will return the width/height of attachments.
Apr 06, 2022 04:57 AM
With Airtable automations I see height and width in the results when doing a test run, but I’m not able to select them as variables to auto fill a field.
Thoughts / solutions anyone?
Apr 06, 2022 06:16 AM
I never noticed that before, but you are correct that Airtable’s Automations don’t give you full access to all the attachment details that the REST API returns.
However, Make.com gives you full access to all the width & height information for your attachments. Not just for the full-sized attachment, but also for all of the thumbnails that Airtable generates as well.
(I haven’t tested this with Zapier, but I’m assuming that Zapier will do the same thing.)
Please see attached screenshot below for all the information that you can pull from an attachment in Make.com:
Jun 10, 2022 07:56 AM
Would there be a way to pull into a field - the image width/height info from a file that resides in Google Drive (in a Table with the Sync feature)?
Jun 10, 2022 07:59 AM
Yes, absolutely! You can do this in a variety of ways (i.e. scripting or DataFetcher.com are 2 ways of doing this), but the way that I personally do it is with Make.com. This is the easiest way in my opinion, because it doesn’t require any code nor any knowledge of APIs.
Jun 10, 2022 02:46 PM
Thanks. Yes, I am playing with Make.com and it seems to work. The issue I am seeing is that the width and height that it is pulling is from the Thumbnail preview that is presented on the table (generated by Airtable), rather than the actual dimensions of the file hosted on Google Drive. Would you happen to know how to query the dimensions of the image file on Google Drive, which is being Sync to Airtable?
Jun 10, 2022 03:31 PM
If you want to pull from Google Drive, just setup the google Drive modules to pull from the Google Drive File ID. However, you probably won’t need to do that, because Airtable stores the width & height data for all 3 thumbnail sizes: small, large, and full. Just choose full: