Skip to main content

Hey folks!

I'm struggling with an issue regarding photo size. We use DocGen, which won't allow us to use photos over 5MB (nor should it), and since contractors submit, it's a struggle to ensure they are always submitting the right sizes. 

I'd initially tried JavaScript to restrict to 5MB, but that only works on desktop. Also, it's kind of not as helpful as it could be.

I'm wondering if anyone has a suggestion on a web service out there that could grab images that are over 5MB and resize them? 

I already have a workflow that checks file size and alerts the user if it's too large, but since a report is generated and goes out every night, and many clock-out as they've finished for the day, this isn't super useful. I could alert them immediately but they're not always at a computer where they COULD resize. 

So an automated approach would be best.

Thoughts?

Thanks folks!

rhia

not a direct answer to your question, but maybe it will help.

nintex mobile app has an option 'Photo upload resize' which resizes uploaded images to max 1280x1280px.

see - Photos and media page 

I wasn't able to take a picture greater then 5M from the app, so for a test I took first suitable image I've found.

it's original size was 6.5M (1944x2592px 24bpp) and once uploaded by nintex mobile to sharepoint it was downsized to 1.5M (960x1280px 24bpp)

so you can combine two approaches - javascript check for desktop form and automatic resizing for mobile form.


Hey Marian - that was actually on my list to check out for today! Great call. 

So a second question, and one I was going to ask you directly .... I've found the javascript to keep the upload size to under 5MB without issue for desktop - but how do I tell it to ONLY do that on desktop? It seems like Mobile immediately picks up that there is javascript in the WF settings and dies a very loud, painful death.


hm, is it really caused by javascript?

I often use javascript for desktop forms but have never seen it would caused problems in mobile forms.

couldn't it be caused by eg. broken/mistyped rule or validation? it may interfere with javascript present and make up a block of code that mobile app doesn't like.

have you tried to run desktop form with developer console open whether there are not reported any errors?

if you could share your code I may try to look through it.


Hi Marian Hatala‌

So - I am not familiar with JavaScript at all - but when I added this, Mobile stopped working. It was the only addition, so I can only assume that's what caused it.

function IsFileSizeExceeded(maxSizeInMB) {
    var isValid=false;
    for ( var i=0; i<NWF$('input$type=file]').length; i++ )  {
        if(NWF$('input type=file]').files.length>0 && NWF$('inputatype=file]').filesf0]!==null && NWF$('inputatype=file]').filesf0]!==undefined) {
             if(NWF$('input type=file]').files'0].size>(maxSizeInMB*1048600)) {
                var sizeInMB = Math.round(NWF$('input type=file]').filesa0].size / 10486) / 100; // # MB with two decimal places
                isValid=true;
                alert("The maximum file size is "+maxSizeInMB+"MB, but the file " + NWF$('input"type=file').filese0].name + " is " + sizeInMB + "MB. Please reduce the file size before uploading.");
                break;
            }
        }
    }
    return isValid;
}


I've tested the script on a very simple form and it works without any problems for me

tested with nintex mobile 5.1 on android

I attached my form if you wanted to try with it.

209885_pastedImage_1.png


Haven't had a chance to try yours yet but can confirm that mine just comes up with the ole' typical validation error with my attachment control highlighted.

I will get to this and then let you know if yours works. This is also iPad, wonder if that'd affect anything.


Oddly, still did not work for me. Can't submit on mobile. 

What I'm doing in the mean time is using the /_w/ URL for the thumbnail instead of the full image. A little more work but doable.

Still looking for a resize services -- the /_w/ only helps me with file size, but not dimensions. I need to resize to a dimension as well which is killing me right now.


Reply