Closed chris-fox closed 3 years ago
@chris-fox Sure.
@aparveen
We recommend showing an informative message to the user and let the user upload the expected dimensions image.
Please let us know your opinion.
@ashishchoure, @aparveen, I don't think restricting image uploads based on dimension is a good solution for end users. A lot of times users are just taking pictures from their phone and attaching to the report. It would be very frustrating to present an error message that they have no way to resolve while attempting to report a problem.
@chris-fox I reached out to our dev team members to see if anybody know if any of our online products do compression at runtime , I will update the team with my findings. Also suggest @CTLocalGovTeam to look at how facebook or whatsapp does their image compression. I came across this article https://venturebeat.com/2019/01/17/facebook-open-sources-spectrum-to-make-uploading-photos-more-efficient/ but not sure how much this will help to solve our problem.
@ashishchoure got this input from our dev team.
The ArcGIS REST API has dynamic resizing for images for its image endpoints Example: Image Resizing: https://www.arcgis.com/sharing/rest/content/items/e987411ac1a8419bbce3f51d2452578f/info/thumbnail/ago_downloaded.jpg?w=400
Normal Size: https://www.arcgis.com/sharing/rest/content/items/e987411ac1a8419bbce3f51d2452578f/info/thumbnail/ago_downloaded.jpg
You add a URL parameter of “w=
The file size is different between the two requests above, so it may be creating a new image dynamically with the resizing URL parameter. This one works with thumbnail image, Could you please look at this option and see if this works?
Few other possibilities
This algorithm uses browser features: https://stackoverflow.com/a/14672943/13778340. From caniuse, it appears that it will work in the browsers that we support (there’s a caveat for IE11 that may prevent that browser).
All have an acceptable license. • https://www.npmjs.com/package/browser-image-compression • https://github.com/fengyuanchen/compressorjs • https://github.com/nodeca/pica • and many more Any library choice will require thorough security review.
@aparveen
Thanks for the information. We will have a look at it and we will get back to you on our findings.
@aparveen
@ashishchoure are you using any third party libraries? If yes, does it need license? We need to do a security review in that case.
@aparveen
@ashishchoure are you using any third party libraries? If yes, does it need license? We need to do a security review in that case.
- No, we are not using any library. Its a Javascript code that will scale the images based on provided size.
@ashishchoure please proceed with the change. Thanks
@aparveen
Here are dimension values that we can add to the dropdown in the configuration panel.
We have taken these values from Survey123, please let us know if you want to update the values.
Items | Is required | Status | Comments |
---|---|---|---|
Required NLS change? | No | | |
Required Backward compatibility? | Yes | ||
Required 508? | No | ||
Need Sanitize? | No |
Impacted Areas | Comments |
---|---|
Have Configuration changes? | Yes |
Have Runtime changes? | Yes |
Impact on RTL | No |
Configuration | |
Runtime | |
Geoform (Add/Edit) | The image scaling should work in geo form add and edit mode |
Comment form (Add/Edit) | The image scaling should work in comment form add and edit mode |
@ashishchoure can we change the label to "Maximum image size on the longest edge" also is it possible to add pixels after the number like survey 123. I think this will provide a clear definition of the purpose of this parameter.
@aparveen
We will do the suggested changes and provide the same in a new pull request at the earliest.
verified in qa
With the Citizen Problem Reporter solution many users use their phone to submit problem reporters and they often attach a picture that take from their phone of the issue, for example potholes, graffiti, street light outage, etc. Modern phones take high resolution photos and these images are large in size and can bloat the service unnecessarily as often a much smaller image is enough to understand the issue.
I would like to add a configurable parameter to the app to allow users to specify the maximum number of pixels for attached images and automatically resize the image down if the provided images exceeds the max. For example maximum pixels=100 scales the image down proportionally to 100 pixels on the longest edge of the image.
Survey123 has a similar parameter described in the doc below: https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformmedia.htm
@aparveen, can we look into this for 9.2?