beckya
September 12, 2023, 9:02pm
1
I am using this script for downloading the image from a database: Download and Upload Files - Ignition User Manual 8.1 - Ignition Documentation
I am able to download it but the type is file and I cannot open it. How do I get it to save as an image that can be viewed on the computer once downloaded?
Try adding a file extension and/or using the contentType
parameter with system.perspective.download
.
beckya
September 12, 2023, 9:30pm
3
Yes, I attempted this but I don’t know what to put in the contentType, do you know?
Depends on the image type. Try image/jpeg
or image/png
.
beckya
September 13, 2023, 12:39pm
5
I verified the image is PNG. I added the following but it still downloaded as a file instead of png. I tried single quotes, no quotes and double quotes.
system.perspective.download(itemnumber, palletscan,["image/png"])
I am referencing this documentation system.perspective.download - Ignition User Manual 8.1 - Ignition Documentation
The square brackets used in the manual indicate it's optional, not that you need to pass a list.
Try this:
system.perspective.download(filename=itemnumber, data=palletscan, contentType="image/png")
Also, is the itemnumber just a value with no extension? Maybe do what @Kevin.Herron suggested but with a slight tweak:
system.perspective.download(filename='{}.png'.format(itemnumber), data=palletscan, contentType="image/png")
Yeah, still an open question as to whether an extension is necessary. He should definitely try it.