Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-22-2012, 02:55 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Displaying an image from a base64 string

Hey, I'm trying to display an image in a GuiBitmapCtrl.
The image is encoded with base64.
So far I have this.
PHP Code:
    temp.img "the base64 string.";  //Too long to post here lol.
    
new GuiBitmapCtrl("TeamViewer_Display"){
      
bitmap "block.png";
      
profile GuiDefaultProfile;
      
height 359;
      
width 520;
      
bitmap base64decode(img);
    } 
But so far it's displaying nothing.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #2  
Old 12-22-2012, 03:21 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
The image name I assume? Have you tried debugging it? Does it give the original image name?
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #3  
Old 12-22-2012, 03:51 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Yes, base64decode returns the correct string, meaning it works the same way as it should. But for some reason it won't display it as an image.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #4  
Old 12-22-2012, 05:12 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Try using GuiShowImgCtrl instead. Not sure what you're trying to accomplish in the long run, but I'd be willing to bet that it'd be more appropriate for what you're doing.


PHP Code:
new GuiShowImgCtrl("Test_ShowImg") {
  
this.image base64decode(temp.img);


I also know this has been pointed out to you in numerous threads, but you really oughta use variable headers all the time.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #5  
Old 12-22-2012, 06:29 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
No luck with showimg.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #6  
Old 12-22-2012, 08:00 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
You have to save the file first.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.img "your base 64 string";
  
temp.img base64decode(temp.img);
  
temp.filename "temp_" int(timevar2) @ ".png";
  
temp.img.savestring(temp.filename0);
  
with (findimg(200)) {
    
100;
    
image temp.filename;
    
layer 4;
  }

__________________
Quote:
Reply With Quote
  #7  
Old 12-23-2012, 01:48 PM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Cheers, your method worked.
Although, i'm sending images from a c# application through a port to my server.
There must be a length, because it doesn't receive the full image.
It only receives part of the base64 string being sent :/
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:53 AM.


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