Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Displaying an image from a base64 string (https://forums.graalonline.com/forums/showthread.php?t=134267623)

Gunderak 12-22-2012 02:55 PM

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.

BlueMelon 12-22-2012 03:21 PM

The image name I assume? Have you tried debugging it? Does it give the original image name?

Gunderak 12-22-2012 03:51 PM

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.

xXziroXx 12-22-2012 05:12 PM

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.

Gunderak 12-22-2012 06:29 PM

No luck with showimg.

fowlplay4 12-22-2012 08:00 PM

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;
  }



Gunderak 12-23-2012 01:48 PM

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 :/


All times are GMT +2. The time now is 12:02 AM.

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