[Solved] Loading and using images
Posted: Fri Dec 09, 2016 4:30 pm
Hi,
Can someone explain to where I must store images that I want to load as part of my web application.
I have an image called background.png and some images that I want to use as toolbar icons.
I have tried storing the png's in a folder called Images in the same directory as the app but I can't seem to get them to load using the following code.
In the debug window I always get Images/background.png: loading error reported from the LoadingBackgroundError() procedure.
Is there a special way that this has to be handled? I'm sure it's something simple that I'm missing but for the life of can't seem to figure it out.
Can someone explain to where I must store images that I want to load as part of my web application.
I have an image called background.png and some images that I want to use as toolbar icons.
I have tried storing the png's in a folder called Images in the same directory as the app but I can't seem to get them to load using the following code.
Code: Select all
Procedure LoadedBackground(Type, Filename$, ObjectId)
OpenWindow(#MainWindow, 0, 0, #PB_Ignore, #PB_Ignore, "Test Window",#PB_Window_Background)
ImageGadget(#PB_Any, ((WindowWidth(#MainWindow)/2) - (ImageWidth(ObjectId)/2)), ((WindowHeight(#MainWindow)/2) - (ImageHeight(ObjectId)/2)), ImageWidth(ObjectId), ImageHeight(ObjectId), ImageID(ObjectId))
FreeImage(ImageID(ObjectId))
EndProcedure
Procedure LoadingBackgroundError(Type, Filename$, ObjectId)
Debug Filename$ + ": loading error"
EndProcedure
Procedure MainBackground()
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @LoadedBackground())
BindEvent(#PB_Event_LoadingError, @LoadingBackgroundError())
LoadImage(#LogoImage, "Images/background.png")
EndProcedure
Is there a special way that this has to be handled? I'm sure it's something simple that I'm missing but for the life of can't seem to figure it out.