[quote=155088:@Vincent Verweij]I have an image in an Imageview. Saving the image to the iPhone crashes the app with a ‘unsupported image format’ error.
Dim saveFile As FolderItem = SpecialFolder.Documents.Child("public.jpeg")
ImageView1.Image.WriteToFile(saveFile,"test.jpeg")
Tried ‘jpeg’ and ‘jpg’ and also a PNG image.
Also, I can’t seem to find the Photo Album as a Special Folder.[/quote]
You are confusing the name of the file and the type to save. This works :
Dim saveFile As FolderItem = SpecialFolder.Documents.Child("mypic.jpeg") // Name of the file
ImageView1.Image.WriteToFile(saveFile,"public.jpeg") // public.jpeg is the type of the file
[quote=155098:@Vincent Verweij]Thanks Michel, sometimes the solution is so simple.
Is there a way to save to the Camera Roll (Photo Album) instead of the Documents Folder?[/quote]
It would be nice to be able to add includes to a project so they get linked upon build. That should be possible. I wonder what Xojo engineers think about that ?
Just saw this conversation - its entirely possible with declares. Just pop this short function into a module and call it like “img.SaveToCameraRoll”
Sub SaveToCameraRoll(extends img as iOSImage)
declare sub UIImageWriteToSavedPhotosAlbum lib "UIKit" (img as ptr, target as ptr, sel as ptr, info as ptr)
UIImageWriteToSavedPhotosAlbum(img.Handle,nil,nil,nil)
End Sub
[quote=156706:@Jason King]Just saw this conversation - its entirely possible with declares. Just pop this short function into a module and call it like “img.SaveToCameraRoll”
Sub SaveToCameraRoll(extends img as iOSImage)
declare sub UIImageWriteToSavedPhotosAlbum lib "UIKit" (img as ptr, target as ptr, sel as ptr, info as ptr)
UIImageWriteToSavedPhotosAlbum(img.Handle,nil,nil,nil)
End Sub
[/quote]