Select to view content in your preferred language

Changing the orientation of a report template based on photo size

1160
2
10-14-2019 12:31 PM
BenjaminZandarski
Occasional Contributor

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
2 Replies
JamesTedrick
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
santamariaa
Occasional Contributor

I have been playing around with this for a bit and cannot seem to get the feature report code to work. We are using your advice @JamesTedrick @IsmaelChivite and comparing the width/height ratio to determine whether an image is portrait or landscape and cannot get the if statement to catch when looping over several photos. Essentially if the photo is landscape make it one size and if it is portrait make it another.  We have a photo log process where we need to take a point and then several photos. So the point and the photos are repeat questions. I've attached our feature report syntax. The image just comes through in two different sizes. Is it possible to use this if functionality with repeat questions? (Funnily enough I ran this through ChatGPT and it could NOT learn the syntax of the feature reports). 

 

Site Inspection Photo Log
Submitted By: ${Creator}
Submitted Time: ${CreationDate}
Site Name:${sitename}
Number of Points at this Site: 	${repeatpoint | getValue:"count"}

Photos:
${#repeatpoint}

Point Pictures
${#pointpic}
${if((($file|getValue:"width")/($file|getValue:"height"))<=1)}${$file| size:500:300}${/}
${if((($file|getValue:"width")/ ($file|getValue:"height"))>1)}${$file | size:300:500}

Direction of Photo: 	${cardinal_directions}
	Automatic Direction Calculation: 	${$file | getValue:"direction"}°
Photo Name: 		${$file | getValue:"name"}
Photo Comments: 	${picnote | appearance:"multiline"}
Point Location: 		(${latitudeGPS_point}, ${longitudeGPS_point})
${point |mapScale:40000|size:600:300}

---------------------------------------------------------------------------------------------
${/}

 

 

0 Kudos