How do I load my data from the url

Get help using Construct 2

Post » Tue Nov 18, 2014 8:18 pm

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

Post » Wed Nov 19, 2014 12:07 am

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

Post » Wed Nov 19, 2014 5:43 pm

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

Post » Wed Nov 19, 2014 10:32 pm

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

Post » Thu Nov 20, 2014 9:20 pm

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

Post » Thu Nov 20, 2014 11:47 pm

@Ragevortex Let me know how it goes. I do not know enough about using strings as images. I do know you can save an image file to a server via the app, crop out its excess transparency, add the URL of the created image to a database, and then retrieve that image(along with other project data) with php/ajax. That method involves way more php than transferring strings, but I know it works because it is how my app's part uploading and thumbnail creation work.

I should look into that tutorial. Does it go into security and protecting the database against malicious queries? All I do is something like $var = mysql_real_escape_string($var); and I'd guess that is insufficient.
B
6
S
2
Posts: 37
Reputation: 524

Post » Fri Nov 21, 2014 6:05 pm

@arrall at the moment there is no issue worrying about the image string transfer. The db has the field set to text which provides more than enough space for it however I may have a problem in my php code or in the line sending the variables because it's not adding anythingto the database... i may have messed up somewhere either on the php or in the event in construct.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796

Post » Wed Nov 26, 2014 9:51 pm

@ashley
@arrall
@ArcadEd
@Joe7
[update] after many many many ... tries I decided to switch to capture the image using the c2image plugin(from joe7) ... that I used to use for my weather app camera tests. Aparently its working; however although it makes the image in the server (which is not empty (0kb) ) it is still not propperly formatted or something because its not allowing me to see it as an image.
The database part is still giving me a headache as for some reason it refuses to save anything to my table. I'm using Ed's example from the scoreboard ... and I simplifyed the infromation being sent as I'm no longer sending the huge base64 string to it. A simpler method would be welcome this is giving me a gigantic headache and my boss wants to see the facebook sharing part working which completeley depends on the previous two parts working. Sigh. yes i know i tend tobuild ambitious complex projects but I like to explore the full capabilityes of this product to the fullest... unfortunateley it also shows me my own limitations in the process hehehe. As always any help is more than welcome.
Freefall Bird
B
47
S
9
G
5
Posts: 280
Reputation: 5,796

Post » Wed Nov 26, 2014 11:32 pm

@Ragevortex I would try sending the php file a manually typed request and putting some echo "Debug: made it this far"; into the php, then see what loads. If you can post a simplified capx and the php I can try to help. I'll try to make an example too.
B
6
S
2
Posts: 37
Reputation: 524

Post » Thu Nov 27, 2014 2:49 am

Are you shooting for something like this?
(it takes a while after you click the upload button to refresh the page.

http://arrall.com/c2/rcam/

with direct links like:

http://arrall.com/c2/rcam/index.php?picid=1
B
6
S
2
Posts: 37
Reputation: 524

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Artcadev, dop2000 and 50 guests