Display an image on a Mendix page that is requested via AWS S3 Connector

1
Hi Mendix friends,   We are trying to offload all our files and images to an Amazon S3 bucket. So far i managed to do this for file documents where the user can upload and download files that are hosted in an S3 bucket.   But we also want to load images (like user profile pictures) from our own Amazon S3 bucket. It is clear how to getObjectRequest and get a file. But now i want to show the profile picture as a image on a Mendix page. I created a dataview with a DS_ Microflow to get the imagefile from S3. But how can i get Mendix to intepret this file as an image and display the image on a page. I am not seeing options for this with the standard Mendix Dynamic Image component. Or do i need an extra module or widget to display images that are requested from S3? Love to hear from you
asked
2 answers
3

Hi Martijn,
We are aware of this issue and apologize for the inconvenience.
In the next release this will be solved by adding the FileDocument as input parameter of the microflow. This FileDocument (or specialization) will be used to store the binary content from S3.
In this way you have to create a FileDocument (or Image) entity yourself and pass it as the input parameter of the GetObject microflow.

answered
4

Hi Martijn,

 

Thanks for asking your question on the forum. There are a few options here. As you already used the getObjectRequest, I assume that you already have the file content/image. If so, I would suggest to store the binary in an object which is a generalization of ‘Image’ instead of ‘FileDocument’. If you do this, you can use the default image viewer of Mendix.

 

The Image widget from the Marketplace also supports direct URL's. Previously, I saw an implementation in which the profile pictures were being shown via a signed URL. This will make your implementation a bit simpler and always up-to-date. The downside here is that you need to fetch the image each time it's being rendered. This can involve higher costs.

 

https://marketplace.mendix.com/link/component/118579

 

Hopefully, this helps!

answered