I have to store images from android app in Azure SQL database, I have tried to search on stack-overflow and googled it on many other sites , but I couldn't find an appropriate answer. I have seen some way on some sites but It was in C#, but I am a java guy. I tried it to find a way on Azure portal, where I just found a Easy Table function through which I can just make a table with no data type to save image.
Plase suggest me a way.
My task is that I have to save one image and 2-3 text strings through android app.
Thanks in advance.
Per my experience, normally saving images in Azure SQL Database is not a good idea. On Azure, the best practice is creating an Azure Mobile App instance to handle the request to save images using Azure Blob Storage. But by now, the Azure Mobile App only supports C# & NodeJS, and I think NodeJS is easy for you, which is express.js on Azure. Please see the tutorial below to know them.
How to use the Azure Mobile Apps Node.js SDK
How to use Blob storage from Node.js
Or you can directly use Azure Blob Storage in Android, that you can refer to the offical documents & samples.
Sample: Azure Storage Service - Photo Uploader Sample for Android
Library: Azure Microsoft Azure Storage SDK for Android
Tutorial: How to use Blob storage from Java
However, to save images in Azure SQL Database via easy table is a required needs. My suggestion is as below.
Encode image within Base64 to a string
Split the Base64 string to a string array, and make sure the length of the array string item is less than the length of the defined character column.
Save the index of the above array as a table column to easy table, then you can recover the Base64 string of image via concat the string array by the index.
Hope it helps.
Related
I'm writing an OnFinalize trigger for Firebase storage when the image is uploaded, we have to capture the long-term persistent download link and need to store it into the Firestore collection.
How to get the long-term persistent download link from Firebase storage. I can see samples using nodejs, javascript, and android but I've particularly required a code snippet on pure java source code.
The expected download url is https://firebasestorage.googleapis.com/v0/b/.appspot.com/o/{folder-1}/{folder-2}/{folder-3}/A5.jpg?alt=media&token={image-access-token}
I developed an android app with google app engine as a server.
Now I want to add photo sharing feature in my app,
Google app engine provides Cloud Datastore/Cloud Storage for large data like images.
My question is that is Cloud Datastore an efficient way for storing and retrieving images or any other third party database is more efficient than Cloud data store/cloud storage.
Please guide me and give me your helpful suggestions.
Cloud Storage is a better solution than a database for storing and serving images, and allows you to do things like Signed URLs (serving content directly, securely).
Directly from the "Choosing a Storage Option" page:
Google Cloud Storage
Description: A scalable, fully-managed, highly reliable, and cost-efficient object / blob store.
Good for:
Images and videos
Objects and blobs
Unstructured data
I am creating the server backend of my Android application in Google App Engine/java. there is a functionality of adding a profile picture.
From Android App,i am passing this image as Base64 encoded stream to my App Engine Servlet. I am confused as to how can i store this image(file) using blobstore api .Then i would create IMageURL of this blob using ImageService API.
Can anyone suggest a best way ,on how to ad
Try this:
1) Decode the Base64 string on App Engine. Alternatively, just POST the file itself without encoding it.
2) Store the image on Google Cloud Storage. Here is an example.
3) Retrieve the image from Cloud Storage using the getServingUrl function from the Blobstore API.
If you are doing image manipulations before serving, you can use the Images API.
I'm developing a knowledge base java application, where I can store and retrieve annotations with its title, date when the note was created (SQL datetime), content, tags about the annotation, etc.
It can be done easily with a database (I'm using SQL Server 2014), but the main problem is that the server is running on my own PC and it has to be always on and running the SQL Server. Also, I would like to extend the application by storing and retrieving this kind of data on mobile apps for Android and iOS.
Is there any other way to store that type of data in some files so it can be uploaded to some cloud storage like Dropbox ? After storing it on Dropbox, all I would have to do is sync the app with dropbox, get the files and read/write stuff.
UPDATE: Thanks for all the answers they helped me a lot. The best solution for me is to replace SQL Server with SQlite, as Gabe Sechan commented. Now I can make changes on the database without the need of a server running 24/7 and I can use the same database on Android and iOS apps.
You can use just a basic ajax call to pull content from a Dropbox "public" URL.
function(contenturl,intoselector,callback){
if (contentwindow.currenttopic!==contentID){
jQuery.ajax({
type:'GET',
url:'//www.corsproxy.com/'+contenturl,
dataType:'text',
async:true,
success:function(data){
intoselector.html(data);
if (jQuery.type(callback)==="function")
callback();
}
});
}
Notice that this example pulls through corsproxy so that you don't receive any XSS errors, so the url you pass needs to not contain a protocol itself.
If you want to pull a JSON or XML string that is stored in the file, then you might need to play around with the dataType and contenttype options in the ajax call.
This can also be done using Google spreadsheets:
Reading:
Create a spreadsheet and publish it on the web
Use one of the many available Javascript libraries for pulling data from Google spreadsheets:
http://jlord.us/sheetsee.js/ (which uses Tabletop.js)
http://chriszarate.github.io/sheetrock/
Writing:
You can use a Google app script for writing to the spreadsheet (reference) OR
You can create a Google form linked to the spreadsheet and simply fill the form from your mobile app whenever you want to add some data to the sheet (reference)
Of all the cloud services, when it comes to Android, Dropbox's Sync API is one of the easiest to implement. Do you need specific code examples on how to sync with Dropbox?
I am currently developing my first Java based RESTful service that should be run on Heroku. This service manages some objects that have associated images. As Heroku is not able to store this images (apart from storing them in a database), I thought of using an external Content Delivery Network (CDN) like Amazon CloudFront. My first attempt to implement this would be as followed:
Encode the image (base64) on the client side.
Send the encoded image encapsulated in Json to the server side.
Decode the image on the server side.
Process the image (scale, create thumbnails, etc.).
Store the image in Amazon's CloudFront using the AWS SDK for Java.
Store a link to the image with the associated object in a postgreSQL database.
Now my question is, if this is the way to go, or if there is a better way to do this and if this GitHub project is a good point to start. If this helps to give an answer - the images are used within desktop and mobile as well as in web-applications.
Store the image in Amazon's CloudFront using the AWS SDK for Java.
Er, CloudFront doesn't store things, it caches things. If you want it stored, you need to put the image on S3 and pay for it every month.
Encode the image (base64) on the client side
Er, why? Just do a PUT or multipart-mime POST, and send the file as bytes.
Send the encoded image encapsulated in Json to the server side
Again, there's no reason to encode it, you can send the metadata + data in the same POST easily without encoding.
Store a like to the image with the associated object in a postgreSQL database
Storing images in a database is an anti-pattern. It makes the database harder to backup, slower to query, etc. Generally, you want to put the image in S3, and store the path in the database.