Jump to content
UBot Underground

call a css file locally and or image locally


Recommended Posts

Has anyone figured out a way to call a local css file or image to use in the ui html panel.

 

These would be file that would be in the application folder.

 

I know this can be done with images by converting to base64, but I'm wanting to do this by files in the application folder instead.

 

 

Link to post
Share on other sites

I haven't figured out a way to do it. I have tried normal html to call the file directly on local machine using file: but it doesn't work.

Link to post
Share on other sites

I  posted this in the elite group you may have seen it already but here it is again in case you missed it

 

ui html panel("<style>{$read file("D:\\ubot stuff\\forms css3\\new css3 stuff\\css\\style.css")}</style>", 500)
  • Like 1
Link to post
Share on other sites
  • 4 weeks later...

You can host your files inside your bot. This includes javascript, jquery, css, and images. For the images you need to encode them to base64 with this website

 

http://www.base64-image.de/

 

You need to set everything as a variable and place it on the on load command.

 

I tried to paste the code here but the forum wouldn't let me so I had to place everything on a text file. You can download it here:

 

http://www.ubotstudio.com/forum/public/style_images/master/attachicon.gifexample code.txt

 

Here is the ubot file:

 

http://www.ubotstudio.com/forum/public/style_images/master/attachicon.gifdemo ui.ubot

 

This no longer seems to work for me in the html ui panel... Whats wierd is, it does work if I take the base64 code and put it in the html itself instead of reading in from a variable.  Anybody else having this problem?

 

EDIT: I figured out a workaround for this... if I put the entire html for the image including the img src="" into the variable it works... like so

set(#encoded image, "<img src=\"data:image/png;base64,blablahblahcode" style=\"width:14px;position:relative;\">", "Global") 


and then of course removing the img src code from the html ui panel and just drop the variable there instead.

 

I'm guessing maybe there is some kind of trailing space or something else messing up the base64 encoding, so wrapping it up like this would stick whatever trailing data is in there at the end of the html and not screw up the display. Hope that makes sense...

Link to post
Share on other sites

This no longer seems to work for me in the html ui panel... Whats wierd is, it does work if I take the base64 code and put it in the html itself instead of reading in from a variable.  Anybody else having this problem?

 

Thats strange, using the code exactly as in willywonka's example works perfectly for me.

Link to post
Share on other sites

Thats strange, using the code exactly as in willywonka's example works perfectly for me.

 

That is strange... To make it stranger I CAN use it as a variable in a load html window the same way he did, but I cant get it to work in the html ui without changing this. Its fine really cuz adding that extra tidbit is no big deal to make it work. Are you running 4.2.16?  Only thing I can think of is we have different versions, or one of my plugins that you dont have is modifying something somehow... even tho I am not using any plugins in this code, I dunno... I got it workin anyway:)

Link to post
Share on other sites
  • 3 weeks later...

there is a free plugin on this forum that make the conversion for you "on the fly" so you can have the image in the install package and install it in the Application folder. It will take it from there every time you open the bot ;) no need to convert it on that site or use third party tools, ubot can convert it using that plugin

 

http://www.ubotstudio.com/forum/index.php?/topic/13237-free-file-management-plugin-multiple-commands-and-functions/?hl=file%20management%20plugin

Link to post
Share on other sites

It looks like the image trick its no longer working with the latest update. I've been playing with this today and haven't been able to make it work as I did it on the example above. I had to put the whole code on the html so it could work which really sucks.

 

Yea, it still works, try it like I posted above and include the whole <img src=""> part in the variable. I suspect there is some sort of end of line, or a space or something being appended after a variable now or something that is screwing up the base64 encoding. By including the html part, any EOL or space or whatever will now get addded to the end of the html code instead of the base64 code so it doesn't screw up the encoding part.

Link to post
Share on other sites
  • 3 weeks later...

 

I  posted this in the elite group you may have seen it already but here it is again in case you missed it

 

 

ui html panel("<style>{$read file("D:\\ubot stuff\\forms css3\\new css3 stuff\\css\\style.css")}</style>", 500)

what is elite group can i be part of the group too ..

Link to post
Share on other sites
  • 4 weeks later...

You can host your files inside your bot. This includes javascript, jquery, css, and images. For the images you need to encode them to base64 with this website

 

http://www.base64-image.de/

 

You need to set everything as a variable and place it on the on load command.

 

I tried to paste the code here but the forum wouldn't let me so I had to place everything on a text file. You can download it here:

 

http://www.ubotstudio.com/forum/public/style_images/master/attachicon.gifexample code.txt

 

Here is the ubot file:

 

http://www.ubotstudio.com/forum/public/style_images/master/attachicon.gifdemo ui.ubot

Thanks a lot for this. 

Link to post
Share on other sites
  • 3 months later...

I'm trying to learn how to work with Base64 images Here's what i've done so far:

1) Created a .png logo for the bot

2) Uploaded it to base64-image.de

       and grab the long string of characters

3) Created this UB code below

on load("Bot Loaded") {
    set(#botlogo, "iVBORwblahblabhblahetc-BASE64-CODE-INSERTED-IN-HERE", "Global")
}

and then i'm lost.

 

I got my UI HTML PANEL working and looking cool. It just misses some images and i don't know how to add some besides hotlinking to them which i don't want to do.

 

Thanks

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...