How to save an image and open it later

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

How to save an image and open it later

Post by Mag » Wed Jan 02, 2013 3:02 pm

Hi all,

I would like to save an image and then open it later, when opening stack again.

To save the image I'm using this code:

Code: Select all

put the long id of image imageName to longIDofImageName
export image longIDofImageName to file ("file:" & specialFolderPath("documents") & slash & "customPreview.png") as PNG
To open the image later, I'm trying to use this code:

Code: Select all

put specialFolderPath("documents") into tFolderPath
put tFolderPath & "/customPreview.png" into tFilePath
set the filename of image "previewImage" to file tFilePath
I also tryied this:

Code: Select all

put URL ("file:"& tFilePath) into image "previewImage"
to date without any luck! :oops:
I read documentation and examples but I'm afraid I'm missing something...

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: How to save an image and open it later

Post by endernafi » Wed Jan 02, 2013 6:26 pm

Hi Mag,

just minor mistakes...

Try this:

Code: Select all

put the long id of image "imageName" into longIDofImageName
export longIDofImageName to file (specialFolderPath("documents") & slash & "customPreview.png") as png
and this:

Code: Select all

put specialFolderPath("documents") into tFolderPath
put tFolderPath & "/customPreview.png" into tFilePath
set the filename of image "previewImage" to tFilePath
I've tried, both of 'em work.
Don't forget to check out the differences.

Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Re: How to save an image and open it later

Post by Mag » Wed Jan 02, 2013 10:24 pm

Thank you so much Ender! There were several errors! :oops:

Post Reply