attachments as image in pop ups not working

1053
4
Jump to solution
08-01-2022 01:25 PM
L77
by
Occasional Contributor

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:

https://services2.arcgis.com/U2xK46wqV8LFc4DT/arcgis/rest/services/Bridges_for_weight_restriction/Fe...

(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.

Lorraine77_0-1659385014808.png

Here are some screenshots:

Lorraine77_1-1659385255536.png

 

Lorraine77_2-1659385305906.png

Lorraine77_3-1659385333456.png

Lorraine77_4-1659385402417.png

 

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?

Lorraine77_5-1659385493843.png

 

0 Kudos
1 Solution

Accepted Solutions
L77
by
Occasional Contributor
0 Kudos
4 Replies
L77
by
Occasional Contributor

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.

0 Kudos
JohannesLindner
MVP Frequent Contributor

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>

 


Have a great day!
Johannes
0 Kudos
L77
by
Occasional Contributor

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.

Lorraine77_0-1659448506885.png

 

But when I view the application the image is still at the bottom of the pop up window.

Lorraine77_3-1659448580977.pngLorraine77_2-1659448570551.png

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?

 

0 Kudos
L77
by
Occasional Contributor
0 Kudos