Sharing sprites with dropbox, help

Trying to get an image from dropbox with a http.request and keep getting a black square, the tll logo url works fine but not my dropbox one. Also won’t work as an asset on CCommunity eg Documents:TestImg Url .
Is dropbox even usable for sharing sprites in this way? Is this the right way to do it?


--# Main
function setup()
    img = nil
    url = "https://www.dropbox.com/s/9y047mmpmelwu4m/TestImg.png"
    --url = "http://twolivesleft.com/logo.png"
    http.request(url,didGetLogo)
end

function didGetLogo( theLogo, status, headers )
    print( "Response Status: "..status)
    img = theLogo
end

function draw()
    background(40, 40, 50)
    if img ~= nil then
        sprite(img,WIDTH/2,HEIGHT/2,200,200)
    end
end

EDIT: I tested my suggestion myself, doesn’t seem to work.

@Jaybob If you can’t get Dropbox to work, do a Goggle search for free image sharing. There are a lot of sites that offer this and it’s easy to read the images you put there.

@Jaybob - Dropbox won’t work because it doesn’t give you direct access to the image. Instead you have to click a button to download the image, as I recall. Codea can’t click buttons for you…

Flickr is just as bad.

What I did was use Photobucket, which does give you access to the image.

Just add this to the link in place of dropbox.com

dl.dropboxusercontent.com

@Briarfox - very cool, I didn’t know that, wish I had! :-bd :-bd :-bd

@Ignatz yeah I was working on a project that used the dropbox api to grab links, after a bit of frustration with the returned links I realized I just had to do a gsub on the links :slight_smile:

@Briarfox - I was looking for a way to do that with Google Drive too, but although there is a way to get a direct download link (replace the “edit” on the end of the usual link with “export?format=png” [for png files]), it is still a webpage with HTML, which is no good.

@Briarfox - thanks for the idea for a blog post

http://coolcodea.wordpress.com/2014/02/17/150-where-to-store-images-for-downloading-by-codea/

Great write up @Ignatz!

@ignatz thanks for saving this important trick on your site. now i’ll know where to find it back.
i use twitter for uploading images, and get the link by pressing the relevant image.
there is also a trick for flicker: i use blogsy which uploads the images to flicker, and then in the blogsy generated code, i can read the image adress. not very elegant, but it works.