将base64映像保存到移动服务SQL或Blob存储? [英] Save base64 image to Mobile Services SQL or Blob Storage?

查看:280
本文介绍了将base64映像保存到移动服务SQL或Blob存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这是交易,我有一个Ionic App,我正在使用带有JavaScript后端的Azure移动服务,我需要将图像保存到云端。
我有一个SQL数据库(当我创建移动服务时自动创建)只有一个表,它将获得有关地点的一些用户信息,其中一个信息是图片。
我使用Cordova相机返回给我一个base64字符串在应用程序上使用,但是当我保存它在我的数据库上显示为null(所以它不保存图像)。

So here's the deal, i have an Ionic App and i'm using Azure Mobile Services with JavaScript backend and i need to save images to the cloud. I have a SQL database (auto-created when i created the Mobile Services) with just one table that'll get some user informations about places and one of these informations is a picture. I use Cordova camera that returns to me a base64 string to use on the app, but when i save it appears as null on my database (so it's not saving the image).

在互联网上,我看到有人在谈论使用blob存储的回合,使用没有移动服务的blob存储,直接在SQL表上保存图像等等。

On the internet i see people talking a bout using a blob storage, using blob storage without mobile services, saving image directly on SQL table, etc.

我想要了解我该怎么做以及我应该如何开始因为我真的很困惑,而且每个教程都彼此有点不同。我的应用程序仅用于演示,所以它不会有很多图像一直进出。

I want a heads up of what should i do and how should i start be cause i'm really confused and every tutorial is a little bit different from each other. My app is just for demonstration so it'll not have a lot of images going in and out all the time.

如果需要我的应用程序的某些代码,请询问我会编辑我的问题。

If some code of my application is needed, just ask and i'll edit my question.

谢谢。

推荐答案

如果它只是一个演示应用程序,尽可能简单。我不熟悉移动开发,但可能会将image base64字符串放入数据库,然后在您的手机上检索和渲染,这可能是最简单的实现方式。

If it's just a demo app, do it as easy as possible. I'm not familiar with mobile development but maybe put image base64 string into database and then retrieve and render on your mobile, which might be the easiest way to implement.

但是如果它是一个产品,我建议使用blob,它比数据库(特别是SQL数据库)提供更多的好处。

But if it's a production, I'd recommend to use blob, which provides more benefits than database (especial SQL Database).


  1. 博客存储比SQL数据库便宜得多。

  1. Blog storage is much cheaper than SQL Database.

支持CDN。

SQL Server数据类型长度限制。如果您只是保存用户的头像,这可能不是问题。

SQL Server data type length limitation. This might not be a problem if you are just saving users' avatar.

更多带宽。检索图像和文件时不会使用SQL带宽。

More bandwidth. It will not use SQL bandwidth when retrieving image and file.

Blob支持自动扩展,可以按容器扩展,按请求频率扩展。

Blob support auto-scale, which could scale-out by container, -up by request frequency.

希望这有帮助,

这篇关于将base64映像保存到移动服务SQL或Blob存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆