How do I load my data from the url

Get help using Construct 2

Post » Fri Nov 28, 2014 2:11 am

@arrall yep thats exactly what I want to make in terms of taking the picture and makign the url.
I ont mind it being a bit slow as long as it works... the end result on the app is well worth a little wait and if the url works as intended it should be able to be shared. I'l see if I can incorporate the latest changes i made into the full app on the "simplifyed"version that I have in my server... ill put up a link in a few.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Fri Nov 28, 2014 4:40 am

@Ragevortex I could not get the webcam's UserMedia.SnapshotURL to transmit properly, nor the canvas2Image.

I take the webcam snapshot with the button, then load it into a dummy sprite. The sprite is on its own layer with a transparent background. I hide the HUD layer, stop and hide the webcam, and take a snapshot of the canvas. I then send the snapshot to the php that cuts off all the excess transparency and then saves the file to the server with a unique filename. (c2cam.php) After it creates the image file on the server, it connects to the mysql database and makes an entry into it for that image with an auto incremented ID field and a field for the complete URL for the newly created file. Something like "http://arrall.com/c2/rcam/i/alsktjasltastts.png" The php then looks at the database for that filename and spits out its ID. That ID is echoed back to the C2 app which then loads that image whenever fed that ID.

This example only saves the image file and the ID for that 'project'. You would want to extend it to have fields in the database for the other parameters, but it could all be accessed with a similar single variable direct link. ie: index.php?picid=12451

I'm not sure if this will work for you or not. It is the only solution to saving an image to a server I have found that works. There are probably others, hopefully someone else will shed some light on this. This involves using Imagick via php.

I'll look again at what you sent me. Let me know if any of this makes sense.
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 37
Reputation: 524

Post » Fri Nov 28, 2014 6:01 am

@Ragevortex Here is an example of loading multiple variables from the single project/card ID. Slight changes to php and results layout. You can use the arrow keys for movement.

(I overwrote the existing site, you will need to refresh the page until it starts with the 'male/hat' list boxes showing.

http://arrall.com/c2/rcam
You do not have the required permissions to view the files attached to this post.
B
6
S
2
Posts: 37
Reputation: 524

Post » Sat Nov 29, 2014 9:44 pm

@arrall that looks cool. I finally managed to make my program work with my database and its saving all the values correctly. I'm still having an internal server error saving my image. I'm looking into what you did with yours to see what is missing. I did notice you mix together the saving of the file with the post of the information(because youre making the filename with uniqueid) - I'm using the random string I'm making in the app for that.

There was a few moments there where I almost gave up the whole thing up until the database part started working correctly(long hours of trying to figure out why it was not working ... fixed it tho). I love how you can make it load the image posted too.

I'm relly behind on this project and have had to take time from the "festivities" to work on it...
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Mon Dec 01, 2014 4:43 am

@arrall ok a quick update mon; thanx a lot fo r all the help too. So far im able to write to the database and save the image (took me a few rewrites of my php your php and some other php but it works much faster now. ) I made a modifyed version of the loadid.php which is returning the correct information (when run separatley) now I'm working on making the app jump to the scene like you did on yours with
?var1=(id thingie) on the url. I'm certain there's a bug on my code because it aint jumping... at the moment I'm working directly on the final program because it takes me time I don't have to be passing from the "simplifyed" version to the production one.
Acomplishments so far:
- Database working correctly
- Image being saved (cleanly and quickly in the correct folder)
- loadid is gettign the correct data from the database.
[edit] found the bug that prevented it from jumping and squashed it. Working now on making it render the scene as intended and that should preety much make it work complete.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Mon Dec 01, 2014 5:01 pm

@ashley hey Ashley sorry to bother you ... thanx (in a big way) to @arrall I've managed to get the project up and running on its own. However I have a php that calls it in an iframe and I'd like that php to be the one using the variable id... is there a way to make the calling php target the iframe with to execute the doit(); javascript or do I have to stick to the original index.php.

example:
website.com/index.php?var1=specialid
will work flawlessly and and load the correct scene since the index.php is actually a slightly modifyed version of the index.html construct 2 makes.

otherwebsite.com/my_other_index.php?var1=specialid
has an iframe with website.com/index.php in it.
I'd like it to be able to work like the other one and modify the scene accordingly.

any ideas/suggestions are welcome.
So far arrall and the community in general and even the scirra store have been great help.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Tue Dec 02, 2014 3:59 am

I think you can pass the ID variable through the iframe's url. like <iframe blah blah = iframe_app_part.php?varid=<?php echo "$varid"; ?> I think the doIt(); belongs in the iframe_app_part.php in this case. I have not tried the embedded export, but iirc it works in the similar situation when you export with the project split into iframes for ads. Just make sure to save the variable in the main index.php file to pass along to the app's url. Then load it pretty much exactly the same in the iframe's php.

Let me know if you get it working or not.
B
6
S
2
Posts: 37
Reputation: 524

Post » Tue Dec 02, 2014 6:31 pm

@arrall I'll give it a try. I'm at the moment redirecting to the inside in_dex.php as the "published version in which the sharing buttons are gone. and from there redirecting back to the "framed" version when they hit the "create your own" button... its a preety nifty workaround for now.

I'm concentrating at the moment on finishing the sharing buttons (which by the way the tweeter one needs to be more like the facebook one @ashley so I can make my own icon and use that as trigger rather than have them load theyr crappy tweet icon) Also I'm working on polishing the details and having all the dancers and musicians in palce. (was misssing 2 groups)

@arral I'll send you a link to the published finished ersion when I'm done arral also... I'll make a "blank"version for a tutorial... since this has given such a hard time I'll be putting the whole thing on writing to help anyone else who needs something of what we've acccomplished here.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Post » Fri Dec 05, 2014 4:50 pm

[update] (ill post this on the main article as well)
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.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,781

Previous

Return to How do I....?

Who is online

Users browsing this forum: megatronx, RetrocadeMedia and 1 guest