简体   繁体   English

MIT App Inventor 可以接收图像吗?

[英]Can MIT App Inventor receive image?

I am still new to cloud and mit app inventor.But I would to ask some question regarding cloud and mit app inventor.我对云和应用程序发明者还是个新手。但我想问一些关于云和应用程序发明者的问题。

But firsty i would like to explain how project should work.但首先我想解释一下项目应该如何工作。 My project is about home security system.我的项目是关于家庭安全系统的。 When a press button is pressed, it will capture the image of visitor and the home owner will receive picture of the visitor on android app.当按下按钮时,它将捕获访客的图像,房主将在 android 应用程序上收到访客的照片。 The android should be able to receive picture and unlock door by pressing button unlock. android 应该能够通过按下按钮解锁来接收图片和解锁门。 The camera used is VC0706 Camera connected to Arduino Mega.使用的相机是连接到 Arduino Mega 的 VC0706 相机。

My question is that can mit app inventor receive picture from cloud since all of the picture taken will be stored in cloud.我的问题是应用程序发明者可以从云中接收图片,因为所有拍摄的图片都将存储在云中。

Accessing images and sounds in App Inventor 2在 App Inventor 2 中访问图像和声音

Applications built with App Inventor can access sound, image, and video sources from three different kinds of locations:使用 App Inventor 构建的应用程序可以从三种不同的位置访问声音、图像和视频源:

Application assets应用资产

The sources labeled Media shown in the designer — part of the application's assets — are packaged with the application.设计器中显示的标记为 Media 的源(应用程序资产的一部分)与应用程序一起打包。 Anyone who installs your application will have them, as part of the application.安装您的应用程序的任何人都将拥有它们,作为应用程序的一部分。 You also specify them in the designer, which is convenient.您也可以在设计器中指定它们,这很方便。 You can also specify these in programs by their file name: just use the file name without any special prefix.您还可以通过文件名在程序中指定这些:只需使用没有任何特殊前缀的文件名。 For example, if you have an image asset named kitty.png, you can use it as an image: just set the Picture property of an image component to the text kitty.png.例如,如果您有一个名为 kitty.png 的图像资源,您可以将其用作图像:只需将图像组件的图片属性设置为文本 kitty.png。 You can similarly use files names for sound (Sound or Player) or video (VideoPlayer).您可以类似地为声音(声音或播放器)或视频(视频播放器)使用文件名。

Assets are the most convenient to use, but the space for them is limited to a few megabytes, because they must be packaged with the application.资产使用起来最方便,但它们的空间被限制在几兆字节,因为它们必须与应用程序一起打包。 They are good for small images and short audio selections.它们适用于小图像和短音频选择。 Bit you would probably not use them for complete songs or videos.您可能不会将它们用于完整的歌曲或视频。

The phone SD card手机SD卡

You can access files on your phone's SD (secure digital) card using file names that begin with /sdcard .您可以使用以 /sdcard 开头的文件名访问手机 SD(安全数字)卡上的文件。 You could play a song on your SDCard by setting the source of a Player component to您可以通过将 Player 组件的源设置为在 SDCard 上播放歌曲

/sdcard/Music/Blondie/The Best of Blondie/Heart of Glass.mp3 /sdcard/Music/Blondie/The Best of Blondie/Heart of Glass.mp3

and starting the Player (assuming of course, that the song file is on the SDCard).并启动播放器(当然,假设歌曲文件在 SDCard 上)。 Make sure to specify the complete file name, including the "mp3".确保指定完整的文件名,包括“mp3”。

The Android system also includes an alternative way to designe SDCard files as URLs. Android 系统还包括将 SDCard 文件设计为 URL 的替代方法。 Here you prefix the file name with file:///sdcard and use "URL encoding" for special characters.在这里,您使用 file:///sdcard 作为文件名的前缀,并对特殊字符使用“URL 编码”。 For example, a space is "%20".例如,空格是“%20”。 So you could designate the same file by setting the player source to所以你可以通过将播放器源设置为相同的文件

file:///sdcard/Music/Blondie/The%20Best%20of%20Blondie/Heart%20of%20Glass.mp3 file:///sdcard/Music/Blondie/The%20Best%20of%20Blondie/Heart%20of%20Glass.mp3

Note that you'll want to use a Player component for this, not Sound.请注意,您需要为此使用 Player 组件,而不是 Sound。 A complete song like this is too large for Sound to handle.像这样一首完整的歌曲对于 Sound 来说太大了。

Images and videos can be designated similarly.可以类似地指定图像和视频。

App Inventor doesn't (yet) include any way to store files on the SD card. App Inventor(还)不包括任何在 SD 卡上存储文件的方法。 It also doesn't (yet) include a way to list the files on the SDCard.它也没有(还)包括列出 SDCard 上文件的方法。 You'll have to use other applications or the Android phone file manager for that.为此,您必须使用其他应用程序或 Android 手机文件管理器。

Using the SD Card provides a lot more space for media than trying to package things as assets.与尝试将内容打包为资产相比,使用 SD 卡可为媒体提供更多空间。 The drawback is that users won't automatically get them by installing your application.缺点是用户不会通过安装您的应用程序自动获得它们。

URLs and the Web URL 和 Web

You can access files on Web using URLs, starting with http:// , for example, setting the picture property of an image to您可以使用 URL 访问 Web 上的文件,以 http:// 开头,例如,将图像的图片属性设置为

http://www.google.com/images/srpr/nav_logo14.png http://www.google.com/images/srpr/nav_logo14.png

and similarly for music and videos.音乐和视频也是如此。 Make sure you use the link that points to the actual file, not to players for the files, which is much more common on the Web, especially for music and videos.确保使用指向实际文件的链接,而不是指向文件播放器的链接,这在 Web 上更为常见,尤其是对于音乐和视频。

Other content URLs其他内容 URL

The Android system also uses URLs to access various places that media is stored on the phone. Android 系统还使用 URL 访问媒体存储在手机上的各个位置。 For example, the images in the photo gallery can be accessed with file names beginning content://media/external/images/media , as you can see by using the ImagePicker and examining the resulting image path.例如,可以使用以 content://media/external/images/media 开头的文件名访问照片库中的图像,正如您可以通过使用 ImagePicker 并检查生成的图像路径所看到的。

App inventor 2 has built-in web storage TinywebDB which stores text strings only. Appinventor 2 有内置的网络存储 TinywebDB,它只存储文本字符串。
In your scenario, post the images to somewhere on the web, and then store the image URIs in TinyWebDB insdie App inventor.在您的场景中,将图像发布到 Web 上的某个位置,然后将图像 URI 存储在 TinyWebDB insdie Appinvent 中。 在此处输入图片说明

Yes, using MIT App Inventor you can send and receive the picture not directly but indirectly.是的,使用 MIT App Inventor,您可以不直接而是间接地发送和接收图片。 First, you have to convert that image to imagebase64 it means in text formate then decode this text to get the original image.首先,您必须将该图像转换为 imagebase64,这意味着文本格式,然后解码此文本以获取原始图像。 It means you can store any images in clouddb or firebase.这意味着您可以将任何图像存储在 clouddb 或 firebase 中。 Here is the video about that https://youtu.be/ySruxnxeJgM这是关于https://youtu.be/ySruxnxeJgM的视频

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM