how would you create a basic URL for an image using getServingUrl() without using Blobs? All the examples I've seen so far involved blobs, but I need to use Google Cloud Storage value.
Thanks.
The Blobstore API allows your application to serve data objects, called blobs, that are much larger than the size allowed for objects in the Datastore service. Blobs are useful for serving large files, such as video or image files, and for allowing users to upload large data files.
A signed URL is a URL that provides limited permission and time to make a request. Signed URLs contain authentication information in their query string, allowing users without credentials to perform specific actions on a resource.
gsutil is a Python application that lets you access Cloud Storage from the command line. You can use gsutil to do a wide range of bucket and object management tasks, including: Creating and deleting buckets. Uploading, downloading, and deleting objects.
There is a new overload for getServingUrl()
with a ServingUrlOptions
method argument. And its builder has a withGoogleStorageFileName()
method that you can use to create a URL based on the Cloud Storage filename.
GcsFilename gcsFilename = new GcsFilename("bucketName", "objectName");
ImagesService is = ImagesServiceFactory.getImagesService();
String filename = String.format("/gs/%s/%s", gcsFilename.getBucketName(), gcsFilename.getObjectName());
String servingUrl = is.getServingUrl(ServingUrlOptions.Builder.withGoogleStorageFileName(filename));
Javadocs:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With