This is basically the code:

com.google.appengine.api.images.Image image = YOU_IMAGE;
GcsService gcsService = GcsServiceFactory.createGcsService();
BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();

GcsFileOptions options = new GcsFileOptions.Builder()
                    .mimeType(p_contentType)
                    .acl("project-private")
                    .build();

GcsFilename p_filename = new GcsFilename(bucketName, secureFilename);
GcsOutputChannel writeChannel = gcsService.createOrReplace(p_filename,
options);
writeChannel.write(ByteBuffer.wrap(image.getImageData()));
writeChannel.close();

BlobKey blobKey = blobstoreService.createGsBlobKey("/gs/" +
p_filename.getBucketName() + "/" + p_filename.getObjectName());

ImagesService imageService = ImagesServiceFactory.getImagesService();
ServingUrlOptions servoptions =
ServingUrlOptions.Builder.withBlobKey(blobKey).secureUrl(true);
String url = imageService.getServingUrl(servoptions);








Alejandro González Rodrigo
*www.nextinit.com* <https://www.nextinit.com/>
*alejandro.gonza...@nextinit.com <alejandro.gonza...@nextinit.com>*
*+34  666 57 79 13*


2014-02-21 21:02 GMT+01:00 Bradford Stephens <bradfordsteph...@gmail.com>:

> Hi there!
>
> I can't find an example of this that strictly uses REST APIs, so I'm
> asking you all. I'm building a mobile photo-sharing app, with java on the
> server-side.
>
> I want to:
>
> -Upload an image to a REST API (preferably served by Endpoints) -- no
> browser
> -Store that image in Google Cloud Storage
> -Retrieve that image's URL and store it in datastore
>
> The first two have me really puzzled...any example code out there?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to