I have an App Engine Connected Android Project, so I am using endpoints. I ultimately converted the bitmap from my Android project into an encoded string to use in my setter, where I converted this string back into a byte array and then to a Blob, and then persisted the blob to the datastore. I know when to retrieve this Blob and display it as the actual image on the app engine front end. How can I do this? I'm a very beginner, especially with using Blobs.
As stated in the official docs.
If you are serving images, a more efficient and potentially
less-expensive method is to use getServingUrl() using the App Engine
Images API rather than blobstoreService.serve(). The getServingUrl
method lets you serve the image directly, without having to go through
your App Engine instances.
So basically having a blobkey you can use
ServingUrlOptions options = ServingUrlOptions.Builder
.withBlobKey(blobKey);
String url = imagesService.getServingUrl(options);
And access that image as "static" content hosted by Google without going through your server.
Related
I got a web application with a Java backend and React frontend. It allows users to upload and display pictures like in an album setting.
The application fetches data from a MS SQL server containing data about an image and then displays it in react.
The database contains a table with information about the image (filename, extension etc.) but not a BLOB.
I am currently displaying the image in react by creating an url from my local machine.
My question is now, what file system alternatives is there when i want to stop storing the images locally on my windows machine. Is it possible to use Google Drive API or something similar? What about SFTP? Would appreciate free solutions to begin with.
You can use Amazon S3 to store your images. store information about the image like file name, bucket name ,... etc in your database and store the image itself in Amazon S3.
There are also other alternatives to Amazon S3 if you want, like MinIO, which is open source and S3 compatible.
Problem Statement:
I´am uploading an image uri base64 from my react-native app to my java backend server. My backend converts the URI String to a byte array and stores it in the MySQL Database (with a BLOB). So far it´s all fine! But when I'am reading/fetching the images from the database I convert them back to a base64 image uri string, to show them to the user (fetching with my Rest api). The problem is, that my Rest API (GET) can handle like 2-3 images and then it runs out of memory... What can I do? It´s because the base64 uri strings are obviously too long for the Rest API...
Any resolution?
In your backend, you should store images as files, not byte array. Convert b64 to file in java with something like this (I don't personally know how to do it)
Once you've done this, your backend has to return you the file's url so you can display it in your app with the Image component from react-native.
I want to
set a name to every blob(image or video) using blob store in GAE and
retrieve it later.
How can this be done in java (is given in Python). So can anyone tell me how can I do this. How can I use the name to retrieve the blob again?
I want to send and retrieve these images from an android device to the google cloud.
I have posted a similar question before as well but did not got a handy answer.
You have to use a blobkey to get a blob. If you want to use another name (like the filename) you have to store this name and the blobkey to get the blob. Only the blobkey is unique. For instance if you upload the same filename multiple times, these uploaded blobs will have unique blobkeys, but they do not have unique filenames.
See also : Google AppEngine Blobstore: Downloading a Blob by Filename in Java
Is there any library/code to show a box in which user inputs images + text in any order, and then the images and text are separately available (for storing into database eg Google Picasa web album or Windows Live Skydrive storage)?
I would prefer it if this can be done in java, however I am open to using javascript or jquery for this purpose.
Basically I want to store a web page section/article that contains images and text- I want to store the images in Picasa and data in Google App Engine's datastore.
One page in my web app will pull the pictures from picasa and dynamically add those to the text extracted from data store.
There is a library called JSON Engine that simplifies storing/retrieving text using JSON on App Engine, so I can use javascript or jquery for the above task... Or I can go with java (which is the language of my web app) ...
I have image URLs like http://example.com/someimage.png - how do I fetch that image and save it with Blob? Thanks.
Here's example code from the documentation showing how to write a file to the blobstore. You'll have to use a stream instead of a writer, since a PNG image is binary, and you'll have to set the appropriate content type, but it should show you the way.
And here's the UrlFetch documentation, explaining how to get some available resource on the web, using HTTP.