Hi,

In my mobile application, when the user uploads the image(tiff/tif) I want to preview the image. but i can't able to view the image in my application.

Can anyone help me out with this issue?

Thank you in advance.

Regards, 

Vitheya.


Solution

Hi Vitheya,

I have had that requirement in the past once. Didn't get it working, as tiff files are not supported by most browsers.

What I did as a workaround is convert the GIFF on the fly toj pg image, using the ConvertTool with ConvertImageType of the Forge component:

https://www.outsystems.com/forge/component-overview/2/imagetoolbox

Regards,

Daniel

Solution

Hi Daniel,

That also tired but it didn't work in mobile application.

If you provide sample oml for that image toolbox functionality, it would be easy to understand.

Regards,

Vitheya S.

Hi Vitheya,

Yes I can do that, but you have to wait, no time during the day, I try in the evening.

But if you already tried that, then you can share what was the problem you were facing using the Image ToolBox, maybe it is something that is easy to fix.

Regards,

Daniel

Hi Daniel,

Thank you for your quick response.

Herewith I attached my mobile application oml which I had implemented the ConvertImageType function using image toolbox component.

Regards,

Vitheya S.

Ok i will look at it.

Hi again,

I got it working, some comments:

The upload widget

  • with Accept set to Image, the .tif file will not be displayed. But the upload will work, but you lack any feedback. You could consider changing the value to Any then at least the selected file is shown.
  • You did not set the FileName, and you want that so that the generated PNG can inherit the same base file name.

The ButtonOnClick action

On the save I used the file name to create a new file name.

Then some notes on testing this

  1. You can only test this on your mobile, not in the Previewer in the browsers, as your solution uses Cordova plugins that are not accessible in the previewer.
  2. When selecting a .tif from the phone storage, I had several applications to do, some worked some don't. I think you have to try that out.
  3. I noticed that sometimes having spaces in the file name could case the SaveFile not to work, but didn't look into that in more detail

See attached the OAP of the mobile app that I create that contains the module that you uploaded with my adjustments.

Regards,

Daniel


And this is the tiff i tested with which was successfully converted to PNG and then shown by the FileViewer plugin.

Hi Daniel,

Thank you for the solution. It works.


Regards,

Vitheya S.