Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-09-2013, 10:11 AM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Issue With Sending Data To Webserver

Hello,

As an experienced webmaster, I've decided to make a way to send certain images and other files to my webserver. I've made a script and scripted my PHP file, and all data gets sent to the server. Everything gets sent to the appropriate folder, but when I try to read images, they will not open. I have successfully opened scripts, text files, ganis, and levels, but this will just not work out for me. I guess I have to encode and decode the image somehow, but how?

Thanks

Edit: The issue was resolved. Here's how I fixed it.
GScript
PHP Code:
if(temp.filename.ends(".png") || temp.filename.ends(".gif") || temp.filename.ends(".mng")) {
  
temp.data base64encode(temp.data);

PHP
PHP Code:
if(endswith($filename".png") || endswith($filename".mng") || endswith($filename".gif")) {
  
$data base64_decode($data);
}

function 
endswith($string$test) {
    
$strlen strlen($string);
    
$testlen strlen($test);
    if (
$testlen $strlen) return false;
    return 
substr_compare($string$test, -$testlen) === 0;
  } 

Last edited by baseman101; 08-09-2013 at 10:07 PM.. Reason: Resolved
Reply With Quote
  #2  
Old 08-09-2013, 10:07 PM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Update:

I have resolved the issue and edited the OP with useful information for other people who have the same problem
Reply With Quote
  #3  
Old 08-09-2013, 11:09 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
You don't need to base64 encode the data (therefore less overhead) if you use the cURL functions and POST the data. You didn't post your code so I'm not sure what you're doing, but in general that would be preferable.
__________________
Reply With Quote
  #4  
Old 08-09-2013, 11:21 PM
baseman101 baseman101 is offline
Scripter
baseman101's Avatar
Join Date: Nov 2012
Location: Purcellville, VA
Posts: 76
baseman101 will become famous soon enough
Quote:
Originally Posted by cbk1994 View Post
You don't need to base64 encode the data (therefore less overhead) if you use the cURL functions and POST the data. You didn't post your code so I'm not sure what you're doing, but in general that would be preferable.
I have used your func_http class to handle posting the data, but without using base64encode() all image files were corrupted
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:19 PM.


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