How do I load my data from the url

Get help using Construct 2

Post » Thu Nov 13, 2014 10:33 pm

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 @arrell 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.
Last edited by Ragevortex on Fri Dec 05, 2014 4:52 pm, edited 5 times in total.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Sat Nov 15, 2014 3:49 am

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/
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 37
Reputation: 524

Post » Sun Nov 16, 2014 4:17 am

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.
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 37
Reputation: 524

Post » Mon Nov 17, 2014 4:29 am

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. :) (up 'til now) I'm certain some more people will be interested in putting some friends faces into a game and/or facebooking an animated postcard to their friends etc. :)
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Nov 18, 2014 2:10 pm

@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.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Nov 18, 2014 2:26 pm

@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.
B
6
S
2
Posts: 37
Reputation: 524

Post » Tue Nov 18, 2014 3:15 pm

@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? ...
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Nov 18, 2014 4:22 pm

Not sure on that one. I'd be very interested to know though!
B
6
S
2
Posts: 37
Reputation: 524

Post » Tue Nov 18, 2014 4:30 pm

@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.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Post » Tue Nov 18, 2014 7:39 pm

@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.
Freefall Bird
B
47
S
9
G
5
Posts: 281
Reputation: 5,803

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests