Saving images in iOS - results corrupt

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

Saving images in iOS - results corrupt

Post by scotttyang » Wed Apr 09, 2014 5:27 am

I am trying to save an image for example image "a" to the specialfoldpath ("Documents") of iOS. It seems to save, but the file saved is corrupt. When I open the file in Preview, it says,

"The file "9372.png" could not be opened.
It may be damaged or use a file format that Preview doesn't recognize."


This is what I have,

set the defaultFolder to specialFolderPath("Documents")
put image "a" into url ("binfile:9371.png")

or

put the imagedata of image "a" into tPic
put tPic into url ("binfile:9371.png")


any suggestions please!!

Scott

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Saving images in iOS - results corrupt

Post by jmburnod » Wed Apr 09, 2014 7:41 am

Hi Scott,

Try this

Code: Select all

get the text of img "9372.png"
put specialfolderPath("documents") & "/" & "9372.png" into tPath
put it into url("binfile:" & tpath)
Kind regards
Jean-Marc
https://alternatic.ch

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Saving images in iOS - results corrupt

Post by Klaus » Wed Apr 09, 2014 12:31 pm

Hi Scott,

or use "export", which has always worked for me:
...
put specialfolderPath("documents") & "/9372.png" into tPath
export img "a" to file tPath as PNG
...

Best

Klaus

Post Reply