Forum Discussion

RandallB's avatar
RandallB
Explorer | Level 3
5 years ago

Best Method for pulling images into webpage

Working in WordPress. I need to use the API to connect and loop thru and display images in a folder.

How do I get the display-able image url? Everything I search tells me to use

get_temporary_link


But when I go to the docs for that, it tells me I shouldn't be using this for my purpose, saying:
"This URL should not be used to display content directly in the browser. "

I'm using list_folder and succesfully pulling lots and lots of data about the images in the folder, I don't understand why the displayable url of the image is not included in the returned object. Seems that would be the perfect place to do it.

What am I supposed to use then?

2 Replies

  • RandallB's avatar
    RandallB
    Explorer | Level 3
    5 years ago

    Using get_temporary_link, I get:
    path_lower": "/tkc enterprise llc/projects/jobs/summit/pictures/cover-photo.jpg", "path_display": "/TKC Enterprise LLC/PROJECTS/Jobs/Summit/Pictures/cover-photo.JPG"

    however I get 404 if I try those paths with  dropbox domain.

    How do I get a link of an image in a folder in dropbox using the API,  that I can use in a webpage using the img tag?
    Example: <img src="path/to/my/image/on/dropbox" />

    ?????

  • kylea's avatar
    kylea
    Icon for Dropbox Staff rankDropbox Staff
    5 years ago

    get_temporary_link returns both a path_lower and a link. The former is a relative path in the Dropbox filesystem; the later is the link you're looking for.

    We do not recommend using get_temporary_link to render content. Temporary links do have associated bandwidth quota; exceeding it may result in blocking it.

    The best way to pull in images for website display would be to generate thumbnails with the API and cache the results.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!