Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Saving Images (https://forums.graalonline.com/forums/showthread.php?t=134265711)

Gunderak 02-06-2012 11:06 AM

Saving Images
 
I am working on a script that would allow users to press a button and send a photo to Facebook, similar to Classic iPhone's and Era iPhones.
I know I have to use the Facebook API to handle the data, but how would I even send a photo from a GServer to an external server?

fowlplay4 02-06-2012 04:25 PM

Load the image:
temp.photo.loadstring("path/to/photo.jpg");

POST the image to the server:
http://forums.graalonline.com/forums...hp?t=134265118

Gunderak 02-07-2012 12:05 AM

Would this send the plain image? or base64?

fowlplay4 02-07-2012 12:20 AM

Whatever format the image is in.

Gunderak 02-07-2012 07:23 AM

Thanks!
One last question, do you happen to know how to upload a photo to Facebook via a PHP script?
It sais I need the cURL extension installed but my host doesn't allow cURL unless I pay.
So I'm at a dead end.
Also say I have a PHP script which gives photo's random names and uploads, is it possible to then send data back to Graal?

fowlplay4 02-07-2012 07:35 AM

You don't need to go through your own web-server, the above POSTing method uses cURL.

Gunderak 02-07-2012 07:43 AM

Yes but the way Facebook's API works it needs to gain an access token before it can upload a photo.
Anyway, is there a way to send data to a server; say for instance I want to make a page where you can submit a .txt file, and then view all text files from Graal.
How would you go about sending data backwards and forwards?
I am eventually going to make it so you can upload images to a website, head's etc then view them on Graal.

fowlplay4 02-07-2012 08:05 AM

You have to use TSockets, or polling with curl requests or requesturl.

Try creating a web application using Ruby and the Sinatra framework (or other similar frameworks) to get a better understanding of how GET and POST works.

Gunderak 02-07-2012 08:18 AM

I understand how GET works.
It adds information to the url, eg if you wanted to send a variable named derp and on the page you had a textbox with the name derp it would be like this.
http://www.url.com?derp=whatever&other=other
Then you use this in php to get it.
$derp = $_GET['derp'];
The only one I don't undertand of the two is POST.
I'll have to do some research :D

Deas_Voice 02-08-2012 10:10 PM

POST is basically the same thing as GET but it doesn't show in the url, so one could say it's 'more secure'.

Gunderak 02-09-2012 06:58 AM

Yes I know, but how it sends the data I want to find out.
With GET it just extracts the information from the URL.
Where as POST doesn't send any extra data in the URL so I wanted to find out how it actually sends the data.

fowlplay4 02-09-2012 07:16 AM

Quote:

Originally Posted by Gunderak (Post 1684096)
Yes I know, but how it sends the data I want to find out.
With GET it just extracts the information from the URL.
Where as POST doesn't send any extra data in the URL so I wanted to find out how it actually sends the data.

http://en.wikipedia.org/wiki/Hyperte...equest_methods


All times are GMT +2. The time now is 07:04 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.