Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Sjoerd
8 years agoExplorer | Level 4
Embedding images without sharing for just the using signed in (trying to build an app)
Hi, I'm trying to build an app to sort images. Mostly focused on holiday images. Since I have these spread through my Dropbox(phone camera uploads, dslr saved to a seperate Dropbox folder, shares fr...
- 8 years ago
Using the temporary links returned by /2/files/get_temporary_link would be the closest thing to what you're looking for. I believe that should technically work for embedding images, e.g., using the link the 'src' for an <img> tag. In what way did that not work?
An alternative would be to make the API calls in JavaScript directly from the browser, e.g., using the API v2 JavaScript SDK, to avoid sending it through your server. That would look something like this:
dbx.filesDownload({path: '/test.jpg'}) .then(function(response) { var blobUrl = URL.createObjectURL(response.fileBlob); var img = document.createElement('img'); img.setAttribute('src', blobUrl); document.getElementById('results').appendChild(img); }) .catch(function(error) { console.error(error); });I'll also send this along as a feature request for a better way to do this via the server though.
Greg-DB
Dropbox Community Moderator
8 years agoUsing the temporary links returned by /2/files/get_temporary_link would be the closest thing to what you're looking for. I believe that should technically work for embedding images, e.g., using the link the 'src' for an <img> tag. In what way did that not work?
An alternative would be to make the API calls in JavaScript directly from the browser, e.g., using the API v2 JavaScript SDK, to avoid sending it through your server. That would look something like this:
dbx.filesDownload({path: '/test.jpg'})
.then(function(response) {
var blobUrl = URL.createObjectURL(response.fileBlob);
var img = document.createElement('img');
img.setAttribute('src', blobUrl);
document.getElementById('results').appendChild(img);
})
.catch(function(error) {
console.error(error);
});
I'll also send this along as a feature request for a better way to do this via the server though.
Sjoerd
8 years agoExplorer | Level 4
Greg-DB wrote:Using the temporary links returned by /2/files/get_temporary_link would be the closest thing to what you're looking for. I believe that should technically work for embedding images, e.g., using the link the 'src' for an <img> tag. In what way did that not work?
This works. It's not perfect, since the image is still available publicly and I have to check/store/retrieve if I've made a temp link recently. But it works!
I tried this in a seperate browser window and you've got some smart stuff going on in the back that renders your site around it if you do this. But as an embedded image it just shows the image.
I very much would like the feature request yes. So I can only see my own images. Is there anywhere I can follow that?
Thanks for the help!
- Greg-DB8 years ago
Dropbox Community Moderator
I'll make a note to follow up on this thread if/when a better solution is implemented.
About 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!