Can you help with a script to send a photo? I can’t seem to figure it out
Luckily the latest beta 1.0 (20) allows you to do this.
let msg = new Message() msg.recipients = ["9108675309"] // <--- array of numbers msg.body = "This is the body of my message" msg.addImageAttachment(img) msg.send()
I understand that part but how do you place the image in to the (Img). I’m still learning
That depends where you are getting the image from. The one script I am working on, I am retrieving the image from a url.
let map = "http://maps.google.com/blahblah/image.jpg" let req = new Request(map) let marker = await req.loadImage() ... msg.addImageAttachment(marker)
There’s a few different ways to get an image. Here’s a few examples.
Getting the latest image from your photo library
let img = await Photos.latestPhoto()
Picking a photo from the photo library
let img = await Photos.fromLibrary()
Taking a photo with the camera
let img = await Photos.fromCamera()
Picking a photo using the document picker
let uti = "public.image" let filePaths = await DocumentPicker.open([uti]) let img = Image.fromFile(filePaths)