150. Where to store downloadable images
So you create an app with custom images, and if someone else wants to use it, they need to download your image(s). I’ve already covered how to do this automatically the first time, here, but where should you put them on the internet?
The problem is that Codea needs to link directly to the image itself, not to some webpage with the image embedded in it. Many popular sites don’t allow this.
Dropbox
Get a shareable link from Dropbox, eg
(I replaced https with hxxps to prevent WordPress trying to actually load the image)
hxxps://www.dropbox.com/s/2w902bqxldfmigu/3D-dog1.png
replace dropbox.com as shown below in blue…
hxxps://dl.dropboxusercontent.com/s/2w902bqxldfmigu/3D-dog1.png
and now you have a direct link that Codea can use.
(Thanks to Briarfox for this tip).
Flickr
If you upload images to Flickr, you can view them in a webpage, but not on their own, which is useless for Codea. However, there is a way to get a direct link to an image. This may not work for long, as Flickr frequently changes their code.
First, view the image normally in Flickr. Then, depending on which browser you are using, view the page source (in Firefox, rightclick somewhere on the page – other than on an image). This should open up a new tab filled with HTML. Look for a URL containing “staticflickr.com” and you can use this URL in Codea to download the image directly.
Google Drive
Google Drive also opens images inside a web page. There is a trick that makes Google download a file when it opens.
Drive links look like this, for an image (the part in red is the file ID):
https://docs.google.com/document/d/1yvtD2A5it_-PoffK12Z3d-wKM90tCiOJ2yq0sNmN8fA/edit
Replace the “edit” on the end, with “export?format=png”, to produce this
https://docs.google.com/document/d/1yvtD2A5it_-PoffK12Z3d-wKM90tCiOJ2yq0sNmN8fA/export?format=png
and this should download automatically. However, the problem for Codea is that this is still a web page with HTML, and not just the image on its own, so it won’t work with http.request.
So I don’t know of a way to use Google Drive images with Codea, yet.
PhotoBucket
This site allows you to get direct links to images without any messing about, so I’ve been using that.
Other Sites
If you know of any others – and how to download images from them – please let me know.
Trackbacks & Pingbacks