How do I load my data from the url

  • 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.

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • 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.

  • 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

  • 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...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

  • 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)

    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.

  • [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.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)