Hello,
I want to display in gallery an image that the user has attached on form, as a sort of thumbnail
Preferably, the user will have Attachments and Upload a picture separately on form, if this is impossible then to view the first attached file as image
I tried for a few hours to get it to work to no avail
Thank you!
Solved! Go to Solution.
If you've got the image in the attachments, you should be able to assign that to an image in your Gallery.
Put an Image control in your Gallery template and set the formula of the Image property to :
First(ThisItem.Attachments).AbsoluteUri
I hope this is helpful for you.
If you've got the image in the attachments, you should be able to assign that to an image in your Gallery.
Put an Image control in your Gallery template and set the formula of the Image property to :
First(ThisItem.Attachments).AbsoluteUri
I hope this is helpful for you.
Hi@imrineeman,
Based on the issue that you mentioned, do you want to display both the first attached image and the latest image you upload?
If you just want to display the first attached image, @RandyHayes posts the correct formula.
Insert an Image control to the Gallery and set the Image property as below
First(ThisItem.Attachments.Value).Value
If you want to display both the first attached image and the latest image you upload, you should insert the second Image control to the Gallery, and set the Image property as below
Last(FirstN(ThisItem.Attachments,2)).Value
Note: If you want to display the latest uploaded image, you should submit the form, and then it will be shown in the gallery.
Best Regards,
Qi
Hello, This works
Only problem im having is that files are sorted alphabetically at the attachment section - can i sort them by last added so that always the first \ last file show as image?
So you're stating that you have multiple attachments and you only want to display the last one in it?
Although the Attachment property is in fact a table of attachment items, It doesn't have an normal ID to it or any other qualifying sequence. So, you could certainly sort based on the fact that it is a table, but there is nothing to sort by.
I would recommend that if you need sorting on it, that you create your own naming of the attachment when it is added. So, for example, you could prepend the name with the date in a yyyymmdd format, and then you can sort on that to find the last one. Or use a sequence number to add to the file name - Text(CountRows(theRecord.Attachments)+1, "00") & originalFilename. Then you will have a prepended sequence number.
Not much other way to work around that one.
User | Count |
---|---|
142 | |
97 | |
89 | |
78 | |
56 |
User | Count |
---|---|
191 | |
185 | |
105 | |
99 | |
91 |