How Do I Get Width and Height of Images Uploaded to AWS S3?

I’m uploading images to the AWS S3 file store using the Wappler “Sign Upload Url” server action.

In this process, i want to store the image width and height as I need it to specify in the OpenGraph meta tag data.

I’ve tried using the “Get Image Size” server action to do this, specifying the path to the file on the S3 server, but I get the message “Invalid Path” from this action, even though the path to the file on the S3 server is correct.

Is the Get Image Size action just for images stored locally?

If so, how can I store the image dimensions of an image I’m uploading directly to the S3 server?

Many thanks,
Antony.

@teodor, do you have a solution you can propose to this question? :thinking:

Maybe try to get image size before they upload to s3.

The image should be stored in a temp folder before upload to the s3 bucket.

If not, and you have runjs custom component install, you can use JavaScript to get the height and width.

var img = new Image();

img.onload = function(){
  var height = img.height;
  var width = img.width;

  // code here to use the dimensions
}

img.src = url;
1 Like

Thanks for that idea @krish… so the img.onload would trigger as the image is uploaded to the temp storage, and therefore I don’t need to know the temp image filename?

Also, I’m not familiar with the custom components… and I’m still using Wappler 3.9.7… so where would I put this code?

Thanks for your help!
Antony.

For RunJS here is the custom components link and in that post there’s instruction on how to get it installed.

Do you mind posting a screenshot of your SC steps ?

Thanks