image downloaded with images.get_serving_url() should default to a pre-defined name

114 zobrazení
Přeskočit na první nepřečtenou zprávu

NP

nepřečteno,
20. 6. 2017 20:32:4720.06.17
komu: Google App Engine
I'm currently using app engine images API and to serve images that I've saved, I call 

images.get_serving_url(blobkey

I want my users to be able to click on the download link I give them and for the file to automatically download with the filename I've already predefined but because of the 'same origin' policy, this is currently not happening.

In addition, if you open the link and then right click to save the image, it doesn't default to my predefined file name. So my question is - is it possible to default a name in the 'save as' dialog for urls retrieved with images.get_serving_url()?

George (Cloud Platform Support)

nepřečteno,
21. 6. 2017 13:13:3921.06.17
komu: Google App Engine
What is the whole get_serving_url line you refer to? 

There is a filename parameter you may use with the get_serving_url command, as documented in the "google.appengine.api.images package" online document

You may customize by other means the "save as" dialog on your page, for instance in JavaScript, using the filename information. 

The replies to the "Clear example of using Google App Engine Images get_serving_url()" question in stackoverflow should be useful as background reading. 

Any extra details on your use of the Images API might prove highly relevant.  

NP

nepřečteno,
21. 6. 2017 22:20:2021.06.17
komu: Google App Engine
Hi,

Thanks for your response.

get_serving_url requires either a blobkey or an image name. I'm currently supplying a blob key. Are you saying, I should replace the blobkey with the image name?

George (Cloud Platform Support)

nepřečteno,
23. 6. 2017 16:54:4323.06.17
komu: Google App Engine
It depends, whether you need the image to be served at different resolution, or not. If your purpose is to offer an image for download, you could rather organize a link to cloud storage. You can gather more detail from the "Request URIs" online document. This is one easier solution possible. 

NP

nepřečteno,
26. 6. 2017 12:39:3626.06.17
komu: Google App Engine
I thought get_serving_url was recommended because it wouldn't count against your bandwidth and usage. Are you saying if one is not resizing or offering the image at different resolutions, it is best to use the direct link to the cloud storage - the one of the form - storage.googleapis.com/<bucket>/[<object>]?

George (Cloud Platform Support)

nepřečteno,
27. 6. 2017 14:43:4727.06.17
komu: Google App Engine
This is just a suggestion. If your purpose is uniquely to serve the URL, get_serving_url is recommendable. If you want to rather offer the file for download under a predetermined name, other options may come handy. 
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv