B4J Question [ABMaterial Sidebar] Image location

GymReaper

Member
Licensed User
Hi everyone and thanks for taking the time to read this.

I'm not sure if I'm doing something dreadfully wrong here but....

I have an ABMaterial application running on a Centos 7 VPS. (Latest b4j and ABMaterial)

I wanted to store logo files in a folder, each file named by the id number of whichever company is logging in so Anywhere Software logo would be 1.png, AlwaysBusy's Corner would be 2.jpg (named after their PK in a mySQL table).

the folder is at "/home/mydomain/CompanyLogos".

(NB - I wanted it here because I have 3 distinct applications doing very different tasks but for the same companies so I just wanted to store their logos in one place)

When a company logs in (using ABMLoginHandler) I build a string which contains the full path and file name and checks if it exists with File.Exists("",CompanyLogo)

This works fine and i get True returned.

Everything goes fine until the ConnectPage sub is executed just before the page is first displayed. In fact the page appears, just not the logo.

I added some logs in the BuildNavigationBar sub to make sure the path was being sent correctly with the following results in Terminal


*************************************************************
Image location in BuildNavigationBar -
sbtopimg.Source = /home/mydomain/CompanyLogos/1.png
logo = /home/mydomain/CompanyLogos/1.png
*************************************************************

so I assumed at this point it would be pointing to the correct place, however when Page.Refresh runs in the ConnectPage sub I'm seeing

Waiting for value (29 ms)
/home/mydomain/CompanyLogos/1.png
Not Found

I *could* just use a catch all logo but I thought I'd give this a try and it's confusing me but I don't want to give up now!

Does anyone have any ideas before I scrap it off and use the catch all logo?

Thanks!
 

alwaysbusy

Expert
Licensed User
I think you will have to make it relative to where the html file is (it might be a right problem to start from so deep in your folder structure?):

EDIT: with rights I mean your jar can access the home folder (or whatever folder on your hd), but the web app only its own 'www' folder, nothing deeper.

e.g.

/myapp/CompanyLogos/1.png
/myapp/myPage/myPage.html

use:
B4X:
../CompanyLogos/1.png
 
Last edited:

GymReaper

Member
Licensed User
your jar can access the home folder (or whatever folder on your hd), but the web app only its own 'www' folder, nothing deeper
With a bit more fiddling that does appear to be the case. I'll figure out an alternative way of doing it at some point and just use a common logo for now - deadlines are looming and I'm spending too much time on unnecessary cosmetics :) thanks @alwaysbusy
 
Top