Save to photos

I’m actually reviving an old request that, so far as I’ve noticed, didn’t get implemented, but it would be nice to be able to save images to photos.

@Mark good one, I remember that request and I’m sorry I never implemented it. I’ll be able to get it into Codea fairly easily, but having it supported through Xcode export is a bit up in the air (as the whole template may need to be reworked).

@Simeon I would like that feature too, but there is a problem. Take this code for example:

function draw()
    saveImageToPhotos(sprite)
end

Boom. You just saved 1000 images and you now have to delete them all.

I think this could be fixed by having a built in safe guard for maximum saved images per project run. This could be set to anything, but would default to something like 10 unless it is specified otherwise in setup()

@Valgo Why do you think that would save 1000 images. saveImageToPhotos shouldn’t be any different than saveImage(“Documents:name”,imageName) which saves one image named imageName to Documents:name. Documents:name could be Photos:name to save it in Photos.

EDIT: Even though you would be trying to save sprite 60 times per second, you would be saving it to the same name, not different ones. Odds are, Codea would probably crash.

@Simeon it was actually Xcode export that reminded me to ask as apparently the ‘access to photos’ privacy flag is getting set somewhere. But not critical for me. I currently save images locally (and pipe them out as coded strings to web services) but don’t save them to photos. However I’ve noticed several apps that offer to save a report or receipt and actually do so by dropping a screen shot in photos. Seemed like a quick and handy option.