Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference Google Cloud Storage image with "img src" (link direct to the image)

Say I do this

./gsutil cp /home/blah/blah/post-images/google/cube.jpg gs://(bucket-name)/google/cube.jpg

The image is supposed to be here

<img src="https://console.developers.google.com/storage/(bucket-name)/google/cube.jpg

(as per https://developers.google.com/storage/docs/access-public-data) but it doesn't work...

That URL is fine if you want to see the image in the "bucket" and browse the bucket's directory structure, but useless if you want to link to the image directly.

I can go here https://console.developers.google.com/m/cloudstorage/b/(bucket-name)/o/google/cube.jpg to link directly to the image, BUT is this "/m/cloudstorage/b/" an arbitrary location or can I always find my images in there? Also what is "/o/" that's not a subdirectory I created. Are these random letters of the alphabet or is there a method to Google's madness or is it always "/o/" ?

In short, what's the correct way to directly link to my Google Cloud Storage images?

like image 313
PJ Brunet Avatar asked May 06 '14 02:05

PJ Brunet


1 Answers

That URL is for the developer's console UI.

See Request URIs for a list of access points.

You probably want:

https://storage.googleapis.com/bucketname/google/cube.jpg
like image 175
jterrace Avatar answered Dec 24 '22 19:12

jterrace