[PLUGIN] Dropbox

  • Hi Septeven

    First of all this looks like a very nice plugin.

    I have one question though..

    How would you go about it if the file from dropbox was an image you wanted to insert in your construct 2 app?

  • cvp

    It's not possible for now, sorry

  • <img src="smileys/smiley19.gif" border="0" align="middle" />

    OK.

    I would be an awesome feature if the plugin could do that.

  • cvp

    You could use the base64 technique that Pode has already build plugins for.

    Meaning.

    In my app i use the "drag & drop zone" plugin to get images into the frame of a sprite via the load from URI event.

    Then at the same time i save that base64 image string into the webstorage under a custom key.

    I upload the contents of the webstorage via the dropbox plugin to dropbox.

    Then i can get that same "savegame" with the images on any other computer.

    I simply download the savegame with the dropbox plugin again.

    And on download i set the base64 images back to the sprites.

    If u want images from dropbox, then base64 is the way to go.

    Combining the dropbox plugin septeven build with the plugins Pode build is key.

    And very simple to set up.

    Hope this helps

    Kind Regards.

    Savvy001

  • Savvy001

    If you can provide an example, I will apreciate ;)

  • septeven i was thinking exactly the same :-)

    Savvy001

    That sounds great. I will see if i can make it work. But as septeven said. If you have the time, an example capx would be very much appreciated.

  • cvp septeven

    Here u go. <img src="smileys/smiley20.gif" border="0" align="middle">

    Dropbox Image Example

    All the logic is in the capx.

    If there are any questions i'l help gladly.

    Ps: In the Capx The Sprite has a variable called Name.

    That is important if u want to save images under different names for different sprites or sprite instances.

    This way u get a nice list in the webstorage easy to retrieve.

    The image variable in the webstorage is always saved as "custom image".

    But saved under the name of the sprite.

    So u could have;

    Sprite name = John

    Webstorage = John & "custom Image"

    Sprite name = Pete

    Webstorage = Pete & "Custom Image"

    Etc

    In the end your dropbox will have a .txt file with the complete webstorage in it, including the images.

    This makes it super for games with user content.

    The nice thing about the dropbox plugin, is that when your app is approved by dropbox.

    The player of the game uses their own dropbox to save the data!

    The plugin just uses your dropbox secrect, letting dropbox know its your app that has connected with the players own dropbox.

    Kind Regards.

    Savvy001

  • Savvy001

    I will take a look soon - Thanks for this.

    Kyatric should stick this one in the FAQ.

  • Thanks for the example Savvy

    Very well commented and easy to understand I might add :-)

    One question though. I might have misunderstood it, so feel free to correct me if I am wrong :-)

    The example you are giving here stores a text file in the dropbox folder.

    And the image comes from the client side.

    Is it possible to load an image which is already in the dropbox. One which is not necessarily "created" by the client, but one which already resides in the dropbox.

    So basically what i am asking, if i have a picture in the dropbox folder already. Can I display it in my app? (maybe I should just have started with that question :-)

    Something like extracting the base64 from the dropbox image. or whatever would make it work.

  • cvp

    The thing is that any normal image that is in the dropbox can't be displayed in your app.

    Construct2 gives u the possibility to load an image from a URL or URI.

    That being said: Dropbox needs permission from the user side to enable u to download.

    So just pointing the "Load from URL" (which is build in action in the event editor) to dropbox will not work.

    Correct me if im wrong on this matter.

    So if u want any image to be loaded into your game.

    Then u have to A: Put a premade .txt AsJSON with all your images in it in your dropbox.

    Or B: Go with the method i presented in the .capx

    Method B: is in short, load image into game/then upload webstorage to dropbox.

    Then later on u can download it again from dropbox back into the game.

    Thats 1-up for multi platform gaming ;-)

    But this method is based on user content for games.

    However u could also use it to build your base64 image collection.

    Which u can then download in other games.

    Hope this clarifies it a bit ;-)

    Kind Regards.

    Savvy001

  • Savvy001

    yeah... that was what i was afraid of.

    I was hoping to build an app which used the images which is already present in dropbox.

    And since its supposed to be a mobile app the drag and drop zone thing is not a valid option. Then again it would not be my intention that the user would have to drag all the images into the app to be able to use them.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • cvp

    Could u explain what the exact thing is u want to do.

    "using the images already in the dropbox" is a bit vague.

    To speak clearly: is it your intention to enable user content.

    Or do u, as the developer want to store all images in a dropbox yourself?

    Kind Regards.

    Savvy001

  • Sorry if i did not make myself clear.

    I want to e.g. display 4 random fotos from my dropbox photo folder inside my app (a photo i took with my camera and uploaded to dropbox).

    I do not need to manipulate them(maybe in size though when displaying) but just to display them.

  • cvp

    By my own experience if you only want to show your pictures, you do not need this dropbox plugin. You can use the "Load URL" action of a Sprite object, PROVIDED THAT, your C2 exported webapp stay located in the same folder of the pictures in Dropbox, AND, this folder is in the public folder of your Dropbox.

  • Savvy001

    By the way, in the usage do you suggest for this Dropbox Plugin, for a user send a picture, it already needs to have an account in Dropbox and be logged in that account?

    I am talking for the first time he use your app!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)