[M]ister Posted January 21, 2017 Share Posted January 21, 2017 Hello everyone I am trying to send a image from MTA Server to my site, however, the file is always empty... I would like to ask a help to solve this. Thanks. Server.lua (MTA) function result(result,error) outputChatBox(tostring(result)) end addEventHandler( "onPlayerScreenShot", root, function ( theResource, status, pixels, timestamp, tag ) outputChatBox("take") callRemote ( "http://domain.com/idk.php", result, pixels ) end ) function doTakeScreenShot() takePlayerScreenShot( getRandomPlayer(), 320, 200 ) end setTimer(doTakeScreenShot, 2000, 1) idk.php (Web) include( "mtaphpsdk_0.4/mta_sdk.php" ); $input = mta::getInput(); $myfile = fopen("newfile.jpeg", "w") or die("Unable to open file!"); fwrite($myfile, $input[0]); fclose($myfile); mta::doReturn(true); Result: Link to comment
Simple0x47 Posted January 21, 2017 Share Posted January 21, 2017 You could convert the image to binary and then recomponse it on the server. 1 Link to comment
[M]ister Posted January 21, 2017 Author Share Posted January 21, 2017 Worked, thank you bro! Link to comment
ShayF2 Posted December 19, 2017 Share Posted December 19, 2017 its not jpeg format, its png, however jpeg will still open it's not advised. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now