Changing the orientation of a report template based on photo size

10-14-2019 12:31 PM
New Contributor II

I am having some issues with the latest update to survey123 report template. I worked very hard getting a report template to print photos that were taken in landscape to fill the page with landscape orientation and photos taken in portrait to fill the page with portrait orientation with metadata for each photo attached. I have attached the template below. This took a lot of trial and error to get working. It worked fine with the desired results during beta and even into the initial release. With the latest release the ability to bypass saving reports to an account was removed. Now the template says it cannot render images. The template searches for and displays all landscape images on a page with landscape orientation. Then I inserted a section break and ran a similar code but only displaying photos that are portrait on a page with portrait orientation 

${#photoLogBegin} ${if ((photo|getValue:"width")>2448)} ${photo|size:980:0}
Site: ${siteNumber} | Project: ${projectNumber} | Image: ${imageNumber} | Aspect: ${bearing} | Tilt: ${tilt} | Photo By: ${photographer} |${dateSubmited} | ${shotTime} | ${photoPoint|getValue:”x”} ${photoPoint|getValue:”y”}
${photoDescription} ${/} ${/photoLogBegin}

A section break is inserted here and the orientation is changed

${#photoLogBegin} ${if ((photo|getValue:"width")<3263)} ${photo|size:720:0}
Site: ${siteNumber} | Project: ${projectNumber} | Image#: ${imageNumber} | Aspect: ${bearing} | Tilt: ${tilt} | PhotoBy: ${photographer} |${dateSubmited}   ${shotTime} | ${photoPoint|getValue:”x”} ${photoPoint|getValue:”y”}
${photoDescription} ${/} ${/photoLogBegin}

0 Kudos
1 Reply
Esri Esteemed Contributor

Hi Benjamin,

Where do you see an error?  I created a form based on the fields used in the template file and it validated correctly.  

If you are trying to detect portrait vs. landscape, I would recommend comparing the ratio of width / height - if it is greater than 1, the photo is landscape, if less, it is portrait.  That would work across all camera devices; the comparison of pixel dimensions may work for some devices (depending on the size of the photo they take).

0 Kudos