Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Aleksandar H.
11 years agoNew member | Level 1
Creating simple image gallery on website powered by Dropbox
I am an average PHP programmer, and I would like to create an image gallery on my website powered by one of my Dropbox image folders. I intensively searched through forum and development section of dropbox but still get a bit confused.
Here is the idea. Amongst all menu links on my page one would be Image gallery. I think it is practical to to use API to make a kind of component for my page which will load thumbnails of my specific Dropbox folder. Clicking on thumbnail would show larger image in shadowbox-style presentation (but thats the website part of programming). It would be easy to handle gallery images on that Dropbox folder since i can add images via my mobile camera, or transfer or delete some of them via any of my computers where i have Dropbox installed. That is much easyer to handle then using some web CMS to handle gallery.
So what I need to build is just simple component based on php language which will pick thumbnails from my Dropbox folder and place them on my website based on response. No other functionality required like deleting, uploading, browsing - just simple presentation.
Now the question is, how and where to start this, which API to use for simple image pulling, I was looking at Core API, Datastore API, Sync API, but I cant figure out which one is the best for the task in PHP, If any of you can narrow my choice and point me to the right direction it would be great, Once I understand which tools i need i could handle the developing proccess.
Thanks...
8 Replies
Replies have been turned off for this discussion
- Greg-DB11 years ago
Dropbox Community Moderator
The Core API would be the best choice for this. You can find the official PHP SDK for the Core API here:
https://www.dropbox.com/developers/core/sdks/php
There's a getting started guide here:
https://www.dropbox.com/developers/core/start/php
The full documentation is here:
https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/
For example, you can use this method to get a thumbnail for an image file:
https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_getThumbnail
- Aleksandar H.11 years agoNew member | Level 1
So, ok, thanks, that was helpful. I got to some degree with the proccess success in authenticated, get account info and even folder metadata, now i am stucked on getting thumbnail using getThumbnail function, with an error: Fatal error: Class 'Path' not found. I cannot find any example of regular call of this function specialy how to create a valid path.
Currently using https://api-content.dropbox.com/1/thumbnails/auto/images/20131205_204518.jpg but that doesnt seem to work.
However it looks to me that it is not possible to get the list of all images in a specific folder/subfolder. So even if I get one thumbnail pulled from my folder this would be hardcoded on a single file name. I presume that it is not possible to make my app show grid of images drom dropbox folder. Or, did i take a wrong turn anywhere? - Greg-DB11 years ago
Dropbox Community Moderator
Can you post the code and full output for the "Class 'Path' not found" error?
The path you use with
getThumbnailis the relative path inside Dropbox, e.g.,/images/20131205_204518.jpg. You can get information about the contents of folders, including the paths you need forgetThumbnail, by using_getMetadataWithChildrenor_getDelta:https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#getMetadataWithChildren
https://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#getDelta - Aleksandar H.11 years agoNew member | Level 1
Greg, you are great, considering your tips and what I learned so far, i managed to get thumbnail, and managed to get folder content. Looping through array i can get all of them. A small tip for everyone reading this: dont forget that getThunbnail function needs to be attached with your client :) For example
$thumb=$dbxClient->getThumbnail("/images/20131205_204518.jpg","jpeg","s");
Now Greg, for the next step, what should i do with the data i get in $thumb[1] which is kind of textual representation of an thumbnail? cant transform it to real image... - Greg-DB11 years ago
Dropbox Community Moderator
That's just the raw data for the image. You can save it directly into a file and use that image file as you would normally.
- Alex P.4210 years agoNew member | Level 1
Please post the code you used. I'd like to create the same thing. Thanks!
- Positive Print10 years agoNew member | Level 1
I want to retrieve all the images of my dropbox account . How can i ??
- Greg-DB10 years ago
Dropbox Community Moderator
You can use the Dropbox API to programmatically list and download files. We recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers
If you run in to any issues or have any specific questions, please open a new thread with the specifics:
https://www.dropboxforum.com/hc/en-us/community/posts/new?community_post%5Btopic_id%5D=200209245
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!