How do I load my data from the url

0 favourites
From the Asset Store
DATA+ (Addon Pack)
$18 USD
20% off
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Ok this looks lke your everyday question however here's the catch.

    This project has changed dramatically recently.

        Used to be a 2 app based project. Now its a one app based project.
        The project should now send data to a mysql database (id, gender, scene, image(in base 64format)).
        Should generate a url with the generated id.
        Should be able to retrieve the information from the database based on that id.

    The app is like an editor. You select an option, take a picture and select another option

    so basically ill end up with 4 variables

      variable 1 is the id for the row that should be unique enough.
      variable 2 is a number (0 or 1)
      variable 3 is another number (0 to 7)
      variable 4 is a base64 string

    --the end result on submit will be a link shareable trough facebook or other social service.

    This shuld enable the app to read on load that information... I'm a bit unclear as to how but the idea is that the app shares it as a url

    when people click it they're directed to the app again and the same url contains the generated id that applies to a row in the database.

    If any of you have an idea about this let me know please.

    Q - why didn't I save the image ?

    A - I don't want to use storage at all for this project

    Uppon further re-thinking this has become a single app provided I manage to solve some issues I'm working on at the moment.

    Thanx for all the invaluable help so far. I know Ive been annoying up to a point but when the project is done you'll have helped build something new that in turn wil become a new tutorial for our comunity.

    Here's a capx and a sample placed on my server.

    test page on my server (not the official server)

    capx for checking

    Any and all the help is greatly appreciated. I'm at a fuzzy-brain-block at the moment and ideas may help clear it up.

    [update]

    Here goes to you all who helped me finish this product successfully.

    The product is now live ( here )

    Special thanks to:

    arrall for being just awesome.

    Ashley for making this great product.

    ArcadEd for the tutorials.

    lucid because spriter is just awesome one of the best inversions I ever made beides Construct2.

    What the final product is.

    This is a free animated personalized social sharable postcard maker.

    This one is localized to the programs produced the station, however when I make my (first) tutorial I'll be using the "generic" file so people can create their own and probably improve uppon it.

    What the final webapp does:

    • It has an animated front screen with music.

    -- that screen has male,female selection buttons and a mute/play button for the music.

    • has a picture capture setup screeen where you frame your face on the given space and take the snapshot.
    • this goes to a simple icon menu that lets you choose a program roster to be a part on.
    • uppon sharing via twitter or facebook this app will also save the picture and related data to a server and give out a custom coded random number/letter id whithin a link which will direct the user to a finished postcard with the settings all set. This postcard includes a button that will in turn return a user to the main webapp site with the editing functions cleared so they can make their own postcard.
  • I'm trying to put together a better example, without all the extra code that made up that app. How are you getting the base64 string? In the example I'm making I am using DragNDrop zone's base64ImageString, but that is part of a plugin itself. Is there some simple way to get the base64 of a Sprite object?

    This example passes 3 variables from one app to another app. It seems to pass the base64string, along with the other parameters. I am just not sure how to convert the string back into a usable image again via C2.

    http://arrall.com/c2passvar/

  • Example:

    http://arrall.com/c2/passvarv2/

    Here is an example with no 3rd party plugins. (I hope) You pick a scale and an opacity offset and it sends it to the second app. I assume you could make the textboxes in the second app invisible/offscreen. It is a combo of php, javascript, and construct 2. But very little code to pull it off.

    I'm still not sure how to load a graphic from a base64 in Construct 2. But sending the string between apps should not be a problem.

    You don't always need 2 apps either. In the brainstorming app I was showing, it would be possible to have it navigate back to the same app with a different node-id passed based on whatever was pressed in the app.

  • Oh thanks! arrall as soon as I get back to work this monday I'll give it a try on my app to see it working. I'm getting the base 64string from a plugin called Canvas2Image which I'm transfering to a text file (or a variable depending on what im trying in my projects) this plugin is golden for me I get to use it for several camera based app concepts and it works awesome. (also saves me loads of time)

    As soon as I get this project running I'm going to have to write down a detailed explanation of how to do what I'm doing with it. So far I've seen no project with the stuff I'm putting in being developped or actually had any of my questions completeley answered.

  • arrall I was able to take a look at your example ... preety sweet. So you mention it's possible to just go back to the same app with a different setting? I'll give that a try at the moment I have 3 layouts. (homescreen (here you pick gender male or female) setup screen here you take a pucture and select the "desired postcard" and in layout 3 I show you the postcard based on the choices made and place the picture on a character as it's face. In this last layout is where one would submit all that information if you'd like to share it on facebook(for example) as a URL. I'm guessing I would need to make a change to the home screen to "read" the variables and pass them to the last screen if the variables are on the link and if not wait for input or something like that.

  • Ragevortex So you want to be able to generate a link directly to a customized composite image within a C2 page? Yep, you could simply check that one of the input boxes was not ""/blank. If blank: show creation menu. If non-blank: load the composite image (layout 3) based on transmitted data.

    In theory the base64 string will be transmitted properly, along with the other data fields. If I recall correctly, there are limits to how much data you can push through the URL like that. Varies by browser.

  • arrall I'm almost set for a test run. I'm wondering, however, if the app is embeded on a webpage and not the main webpage itself will it affect the outcome? ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure on that one. I'd be very interested to know though!

  • arrall well at least it loaded...(had to move it from the google drive to the test server ... for some reason when using php in google drive it tries to download the darn file)

    I have to check the logic for the load or skip to scene part I may have made a mistake since its waiting a little then skipping from the get-go instead of staying there when first loaded.

    I'm not using buttons or texts for the most part I'm just using global variables.(and hoping the minor changes i did to the php are correct)in the end I might just add the txt files hidden just to make sure it doesnt mess up.

  • arrall - Progress report - as of now I've been fighting with a little issue generating the link. (added the popup plugin to show myself whats going on... I couldve used browser's alerts but im lazy like that. ) So the numeric variables were being added correctly to the string for the url however the base64img string was not... i'm fixingthat as I write this (btw its a huge string) hopefuly it will be working good enough in a few mins that i can go to the sharing part and see if itsworking. (i also placed a popup box there so i can see the actual link being made and i can actually copy it from there in hopes the app reads the thing correctly...

    -Edit- as it turns out after all my troubble the problem was a syntax error when I changed the url variables for mine.... lol made me waste 20mins trying to fix it heheh.

  • arrall Ashley So far so good. I'm wondering however if i need the variables to be loaded in the php outside the iframe or the one from construct2. The question comes because If i place it on the outside and the url is default (no variables in it) it gives me 3 errors (becaue var 1-3 are alegedly not defined) when I use the link made by the app it doesn't give me the error but it's also not going anywhere and stays on the main screen...

    when I do the same on the inner php (the one in the iframe) it doesn't show me any errors but also doesn't do anything in terms of moving to the desired scene. As always it may be an error on the way I've implemented it.

  • Ragevortex and anyone reading this: unless someone knows how to get the client's browser and the server to handle links that are really really long, this method will not work. The strings resulting from the image extraction of the sprites I was testing with were >16000 characters. Not sure how you would send someone a link that was +16k characters reliably.

    The only solution I can think of for the "send personalized user images to an app via parameters to the url" is to save the captured/custom image to a server and add it to a database. Then send links to your app like "http://myapp.com/load?id=projectid" which you could then process via AJAX without running into that max url/i limit.

    Very sorry for the wasted effort.

  • arrall I wouldnt call it a wasted effort. Learned a few things along the way. I'm going to attempt another strategy for that with a database but it will take me a little more thinking. maybe i can get an id and target that...

    Also the caracter length I've been getting from the app has been 2k-3k(which is still preety big) you must be using huge images or something if youre getting 16k.

    I'm still looking into other solutions however the link part is a must for this app... even if i have to find a way to shorten it by implementing mixed solutions. As soon as i have a working demo ill post it on the site again.

  • arrall I'll be using the concept behind This tutorial from ArcadEd with a few modifications to see if I can still use the base64string w/o making an ugly huge link. I need to figgure out a way to add an id that I can retrieve, is unique enough so that no two users have it and I can load/save it to my db as a refference. That way I could just use that id in the link instead of all the 3 variables. I guess it should still be a feasable solution. Also it will let me use the other part of my php to see which "scene" gets more hits by counting them.

  • arrall Hi there. I updated the capx with some modifications. The app now "makes a random string" which should be sent trough php to a mysql database and on the "retrieval process" (soon) it should serve as a "shorter link". I'm hoping this works a little better. Still hammering it down to submision tho.

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