How do you write the url of Firebase storage to show an image in a browser?
because when i try to use this gs://askdoctor-546bf.appspot.com/askdoctor/namasuba.jpg it doesnt work , now which way should we view our images stored in the Firebase storage via url.
Example URL request from the documentation Create a Reference
httpsReference = storage.refFromURL('https://firebasestorage.googleapis.com/b/bucket/o/images%20stars.jpg');
Related
So currently I have images stored in gcp storage.
When I fetch an image, I receive a File object with several parameters. Being one of them mediaLink with a format like https://storage.googleapis.com/download/storage/{path}%{image_name}?generation={value}&alt=media
The problem is that this url is only accessasble with permission, I want to be able to save the image as a JPEG so I can later send it to the user via email.
Is there any way this can be achieved?
Thank you in advance.
To grant access to a object on Cloud Storage for an user without change the bucket to public or require user authentication you may use Signed URLs. With a Signed URl you will be able to share a temporary link to get or upload a file.
More info about here
I deployed the web application. It is successful but my image files doesn't appear on web page.
I receive No such file or directory: 'gs://imajo/media/predict_resim.jpg' error.
Here is the code I typed. I typed it on google cloud. how can I solve this in an easy python way?
htp7='gs://imajo/media/planner_resim.jpg'
image7 = Image.open('htp7')
and this is the deployed app. (It is About anaylisis page)
https://easy-inventory-planner.ew.r.appspot.com/
You tried to access Google Storage file using Google Storage Protocol link which is private and you need authentication to get that file.
Python Google Storage Client
In order to get file on Google Storage with that link you can use Python Google Storage Client, more info and examples on how to authenticate and download file can be found here:
https://cloud.google.com/storage/docs/reference/libraries#cloud-console
Making File Public
Other option is to make your file public, that way you will get publicly accessible link (http) to your file, and then your solution will work.
Find your file in Google Cloud Storage Browser (https://console.cloud.google.com/storage/browse)
Click on three dots on the far right side of your file
Choose edit permissions
Add entry with Public, allUsers and Read
Once you Save, you will have Copy URL in the Public access column on file listing.
This link is publicly available.
Paste https link to your program and it will work. This link is https:// instead of gs:// which is only accessible through client. It looks something like this: https://storage.googleapis.com/imajo/media/predict_resim.jpg
I have a blob that is (according to Azure) at a URL of: https://surveillanceprodblob.blob.core.windows.net/rpi-events//BAs1nRTx/00001f240_2020-05-12_10-12-06.png
The problem here is that the blob starts with "/BAs1nRTx".
Is it possible to access this object from a browser? I have tried
Removing the second slash so the url is: https://surveillanceprodblob.blob.core.windows.net/rpi-events/BAs1nRTx/00001f240_2020-05-12_10-12-06.png
Replacing the slash with %2F so the url is: https://surveillanceprodblob.blob.core.windows.net/rpi-events/%2FBAs1nRTx/00001f240_2020-05-12_10-12-06.png
Adding another slash so the url is: https://surveillanceprodblob.blob.core.windows.net/rpi-events///BAs1nRTx/00001f240_2020-05-12_10-12-06.png
None of these worked for me.
Is it possible to access this blob from a browser?
EDIT:
Here is what the portal shows
I have a file at /a/b/c/10dec.csv location same as yours.
When I tried to download https://[STORAGE_ACCOUNT].blob.core.windows.net/test-archive-container//a/b/c/10dec.csv it failed.
But, when I tried to download using https://[STORAGE_ACCOUNT].blob.core.windows.net/test-archive-container//a/b/c/10dec.csv?[BLOB SAS TOKEN] it works.
So, I think directly using BLOB URL you cannot download from the Browser, you always need to authenticate. That's why you will need to provide SAS TOKEN.
Please Generate SAS as shown below:
And use that URL in Browser, it will work.
Please let me know if you need more information.
I am using Cloudant for uploading and getting back images. Cloudant uses basic auth to validate users for reading images. Now I want to make a picture gallery by getting back all the images stored in cloudant and I am planning to use tags with the url for images stored in cloudant. If I use img src="https://username:password#myapp-bluemix.cloudant.com/db/docName/attachment_name I am getting the following error
Url containing embedded credentials are blocked
Is there a way to get a signed url for this as is possible in S3 so that I can use it in my img tags as src?
It looks like Chrome is preventing a URL containing embedded credentials being fetched from with a web page.
There is no way to create a pre-signed URL, as S3 has.
This leaves you with a few options:
make the database "world readable", although this is probably not an option for you.
deliver your images through a proxy - a "serverless" cloud function could be written that has read access to your Cloudant database and streams selected attachments in response to a web request.
adopt a hybrid approach and store your image meta data in Cloudant but store the binary blobs in Object Storage, which is much better fit for storing data. Here is a blog post about detaching attachments from Cloudant and storing them in Object Storage and another about creating a pre-signed URL to allow their download.
I have an image in my AWS S3 bucket. Is it safe to include this image in my website by placing the AWS URL in an <img> tag? The URL includes parameters such as "Amz-Signature", "Amz-Credential", and "amz-security-token. Could these be used maliciously to get to access other files in my S3 bucket?
Here is an example URL:
https://s3.amazonaws.com/MyBucketName/FileName.jpg?X-Amz-Date=20160126T141139Z&X-Amz-Expires=300&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=Lots_of_letters_and_Numbers2&X-Amz-Credential=MYAMAZON_CREDENTIALS/20160126/us-east-1/s3/aws4_request&X-Amz-SignedHeaders=Host&x-amz-security-token=REALLY_LONG_SECURITYTOKEN
Alternatively, I can generate an expiry URL from my C# code using the AWS SDK. Something like:
var expiryUrlRequest = new GetPreSignedUrlRequest
{
BucketName = WebConfigurationManager.AppSettings["AWSBucketName"],
Key = fileName,
Expires = DateTime.Now.AddHours(3)
};
This yields a URL that has "AWSAccessKeyId" as a parameter.
Are either of these URL's safe to use in my webpage? What risks would be involved in using them on my site?
Thank you very much for your time. Please let me know if you need additional information or if I am being unclear.
EDIT: To provide some further insight into my application, users are uploading a file to an S3 bucket. I'm using SignalR to confirm that the image is in the bucket by displaying the image from S3 on my webpage for the user to see.
Do not make the bucket public. If you do, then potentially user1 could see user2's uploaded files.
You can allow users to retrieve single files for a specific period of time using pre-signed URLs.
Mark the S3 bucket as private.
Use GetPreSignedUrlRequest to generate a pre-signed URL for the file you want the user to download.
Use that URL in your <img> tag.
Using this technique is safe:
The user can only download the file during the timeframe that you permit, until the expiration date (which you set as part of the GetPreSignedUrlRequest call)
The credentials you see in the URL are may be the same as those that were used to create the URL. But they are safe to show the user.
The user cannot download any other files from the bucket.
The URL uses a hashing technique to ensure the URL cannot be modified, nor can it be abused to get other files.
If displaying the access key ID is a concern, you can either (a) create an IAM user specifically for the purpose of downloading the files from S3, or (b) use an IAM role on your EC2 instance to generate the pre-signed URL.
References:
http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html
First of all, there are two ways of restricting access to the content of a bucket:
Private - users need the AWS credentials to access that file (in the same way as shown in your answer)
Public - everybody can access the content of the bucket (https://myBucket.s3.amazonaws.com/myFolder/myFile.jpg)
If you want other users to access the image (for example by providing a URL for your website), you should mark the bucket as public.
DO NOT post the url with your AWS credentials anywhere!!!