I am new to appengine and html and need some assistance. I have deployed the following html file to appengine but I nee to get urls for all images as follows http(s)://hostname/chosenpath/1 (i.e 1 for image 1 and so on)
Any help will be greatly appreciated. Thank you
<!DOCTYPE html>
<html>
<body>
<figure1>
<img src="https://storage.googleapis.com/ccws-cw1-bucket/e4.jpg" alt="Glasgow city" width="500" height="333" title="Glasgow City">
<figcaption>Glasgow City located in Scotland</figcaption>
</figure1>
</figure2>
<img src="https://storage.googleapis.com/ccws-cw1-bucket/image.jpg" alt="Islamabad city" width="500" height="333" title = "Islamabad City">
<figcaption>Islamabad City is the capital of Pakistan</figcaption>
</figure2>
</figure3>
<img src="https://storage.googleapis.com/ccws-cw1-bucket/Istanbul.jpg" alt="Istanbul city" width="500" height="333", title = "Istanbul City">
<figcaption>Istanbul City is a city in Turkey</figcaption>
</figure3>
</body>
</html>
CodePudding user response:
You could potentially do the following
Have a special path like
http(s)://hostname/chosenpath/img/1
. Hereimg
is a special folder in your pathWrite a route handler to process any route that ends in
/img/
where you then go manually retrieve the file and return it to the user. You can also do a redirect from here to thehttps://storage.googleapis.com
url
You can also keep the url path you mentioned but add code to determine that the file being requested by user is an image file (check that it ends in .png, jpg, etc) and then you redirect the user to the https://storage.googleapis.com
url