Select to view content in your preferred language

Force photo orientation?

478
6
3 weeks ago
RHammers
Occasional Contributor

Hello!

Is there a way to force photos taken in the field app to be in landscape orientation? A recent ESRI update seems to have broken one of my feature reports that has a number of photos in it, one of which is supposed to be taken in landscape by the field app user and is subsequently displayed on a page in the feature report that is landscape orientation. The report used to generate without error regardless of whether the photo was taken portrait or landscape, but not after the recent ESRI update. The problem now is that users continue to disregard the warning message that tells them to take the photo in landscape only.

Any help would be greatly appreciated!

0 Kudos
6 Replies
MErikReedAugusta
MVP Regular Contributor

Since the ultimate problem sounds like the report, it might be helpful to try to tackle that side of things.

By your description, it sounds like a default "fit to frame" turned into a default "fill frame" and/or auto-rotate.  So the first things I would recommend checking for are a setting to manually tell the report not to rotate the image and instead to just cram it into the available frame, assuming that behavior is still acceptable (and that I've properly understood the original behavior).

---

Regarding the Survey123 side of the issue, there is an already-extant Idea requesting this functionality that does not appear to have been implemented, yet.  I'd recommend adding a Kudo to this, as that's partly how ESRI tracks & prioritizes requests from the community for new/altered functionality in its products:

https://community.esri.com/t5/arcgis-survey123-ideas/allow-xlsform-to-enforce-photo-orientation/idi-...

---

Lastly, it appears to that orientation information is stored in a photo's EXIF data.  So long as Survey123's built-in photo functionality is properly recording EXIF data, there's a nonzero chance you could code an auto-rotate into your report, but that might be decidedly a not-insignificant task.

------------------------------
M Reed
"The pessimist may be right oftener than the optimist, but the optimist has more fun, and neither can stop the march of events anyhow." — Lazarus Long, in Time Enough for Love, by Robert A. Heinlein
0 Kudos
ZhifangWang
Esri Regular Contributor

Hi @RHammers ,

Could you confirm whether the same feature report template syntax has recently started displaying the same photo differently? We released the Survey123 September 2025 update last week and want to check if it may have affected your reporting workflow.
If so, would you mind sharing the report template syntax and a sample photo so we can investigate?

0 Kudos
RHammers
Occasional Contributor

@MErikReedAugusta Thank you for the detailed reply, it is very appreciated!

@ZhifangWang I would be happy to share what I can!

Regarding the photos, the issue is that generating the feature report fails completely. The feature report template syntax has not changed. The error message is:

An error occurred when rendering by the report engine. Cannot read properties of undefined (reading 'value')

I can't share the photo publicly though, it would contain sensitive information. However, I believe I have narrowed the issue to a specific field. Here is the syntax:

${#haccppic} ${$file | getValue:"" | size:950:0} ${/}  

This particular photo is generally taken in landscape, and I have set the orientation of the page in the report template to landscape.

Edit: I believe I have figured it out. The fix was to set the page orientation back to portrait, upload the template, then set the orientation back to landscape and upload it again. After that, it appears to be working.

0 Kudos
ZhifangWang
Esri Regular Contributor

Hi @RHammers ,

Thanks for sharing the details.

I tried the following steps on my end:

1. Publish a new survey on the Survey123 website, with a text and image question.

2. Submit a photo in the Survey123 field app, with a photo taken in landscape orientation.

3. On the Data tab of the Survey123 website, upload a .docx template which the layout is set Landscape, and with your example image syntax.

However, I was able to print the report successfully. Please let us know if you could find the exact steps to reproduce the issue so we can investigate further.

0 Kudos
CameronRex1
Occasional Contributor

@RHammers Concerning the issue of "The problem now is that users continue to disregard the warning message that tells them to take the photo in landscape only."

You could handle this by using the Exif data from the captured image. Something like this (I am putting this into more questions than necessary to demonstrate):

1.) Image question
     - type: image
     - name: image1
     - label: Image
     - hint: "You must take photo in Landscape"

2.) Get the Exif Orientation value of your image (via EXIF ImageOrientation)
     - type: integer
     - name: exif_orientation
     - label: Exif Orientation Value
     - readonly: yes
     - calculation: pulldata("@exif", ${image1}, "ImageOrientation")

3.) Let's first make sure an image is loaded and then evaluate whether it is Landscape or Portrait (Human-readable orientation)
     - type: text
     - name: orientation
     - label: Orientation
     - readonly: yes
     - calculation: if(count(${image1}) = 0, "No image", if(${exif_orientation}=1 or ${exif_orientation}=3, "Landscape", "Portrait"))

4.) Now let's block a survey from being submitted if image1 is in Portrait (note acting as blocker)
     - type: note
     - name: blocker
     - label: Please retake the photo in landscape mode
     - required: yes
     - constraint: false()
     - constraint_message: Please retake the photo in landscape (wider than taller)
     - relevant: ${orientation} = "Portrait"

How it works:

- If Exif ImageOrientation is 1 or 3, the photo is treated as Landscape.
- If it's 6 or 8, it's Portrait
- If no image is present, Orientation shows "No image", and the blocker does not appear.
- When Orientation = "Portrait", the block becomes visible and required, and its constraint of false() prevents submission until a landscape photo is taken.

Notes:

- This does not work with the multiline appearance for images (I believe). If multiple photos are needed, use multiple image questions and apply the same check to each (or combine them into a single blocker).

Hope this helps you or anyone else looking for a solution to forcing "Landscape" or for that matter "Portrait".

Here is a more condensed version with only an image and a blocker:
1.) Image question
     - type: image
     - name: image3
     - label: Image 3
     - hint: "You must take photo in Landscape"

2.) Single blocker
     - type: note
     - name: blocker3
     - label: Please retake the photo (Image 3) in landscape mode
     - required: yes
     - constraint: false()
     - constraint_message: Please retake the photo (Image 3) in landscape (wider than taller)
     - relevant: count(${image3})=1 and regex(string(pulldata("@exif", ${image3}, "ImageOrientation")), '^(6|8)$')

BrianShepard
Regular Contributor

I had a need to do this today and came up with a similar approach as @CameronRex1 using ImageOrientation from the photo's exif data.

Create a question to get the ImageOrientation exif value from an image question called "PhotoQuestion" with Calculation pulldata("@exif", ${PhotoQuestion}, "ImageOrientation"). I used a read-only Note with Hidden Appearance and null as the Esri Field Type so it doesn't create a field and store the value in the feature service. We'll call it "PhotoOrientation".

I then created another read-only Note with null Field Type that displays a warning message (as the Label and Hint) if the photo is in the wrong orientation using a Relevant statement:

If portrait orientation is desired: ${PhotoOrientation}<5 and ${PhotoOrientation}>0

If landscape orientation is desired: ${PhotoOrientation}>4

I currently do not want to constrain those fields in case there's a reason a user cannot comply, but in testing you could use the Relevant statements above as Constraints in the PhotoQuestion and it'll prevent the user from submitting if the orientation is incorrect.

References:

exif pulldata options: Media questions—ArcGIS Survey123 | Documentation

ImageOrientation values: Photo orientation. Survey123 app - Page 2 - Esri Community