I followed these instructions to get my attachments to show up as an image, but it isn't working.
https://community.esri.com/t5/arcgis-online-blog/show-attachments-in-pop-ups-with-arcade/ba-p/890588
My attachments are pdfs
I am using Map Viewer Classic.
Here is an example of one of the attachments:
(note that instead of services.arcgis my link is actually services2.arcgis, and instead of there being a /0/, mine is /16/ for all of my attachments, also my object id is ObjectID_1)
Here is what I put in the arcade expression:
var Part1 = 'https://services2.arcgis.com/U2xK46wqV8LFc4DT/arcgis/rest/services/Bridges_for_weight_restriction/Fe...'
var ObjectID = $feature.OBJECTID_1
var Part2= "/attachments/"
var AttachID= $feature.AttachID
return Part1 + ObjectID + Part2 + AttachID
When I click Test, the Result link is correct so it should work.
The only thing is that the pop up window shows the image symbol and not the actual image.
Here are some screenshots:
If I right click and select copy link or open in new tab then it works, it just doesn't display the image. Could this be because it is a pdf?
Solved! Go to Solution.
I also tried adding the images of the weight restricted bridges signs as jpg files too.
I uploaded the jpgs to our website and tried adding them adding them as linked images but I am still getting the same error.
Could this be because it is a pdf?
Yes. The popup image section is basically a GUI wrapper for the HTML
<img src="{expression/expr0}">
img tags can only show images, not pdf. To show pdf, you can try using the embed tag (don't know if this is blocked or not):
<embed src="{expression/expr0}"></embed>
or you can try iframe:
<iframe src="{expression/expr0}"></iframe>
If these don't work, you're probably stuck with just showing the link:
<a href="{expression/expr0}">Click this link!</a>
That makes sense.
What I decided to do instead is add the image as a jpg and I want it to show up at the top of the pop up window.
I originally configured the map in Web App Builder Classic, and I can't seem to get the image to show up at the top of the pop up window in Classic.
But if I open the map in Web App Builder, I can drag the image to the top of the pop up window and it works.
But when I view the application the image is still at the bottom of the pop up window.
Do you know how to get the image to show up at the top, or can I switch back and forth between Classic and the new web app builder, or do I need to try to rebuild it?