HTML linking to referenced images
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
HTML linking to referenced images
Hello!
I thought I would be clever and keep my filesize small by using referenced controls. But when I export the HTML5 and upload it, it doesn't take the images along. I'm sure there's an easy fix but I can't find it! Please help!
I thought I would be clever and keep my filesize small by using referenced controls. But when I export the HTML5 and upload it, it doesn't take the images along. I'm sure there's an easy fix but I can't find it! Please help!
Re: HTML linking to referenced images
How are you "referencing" your images?
If you are using relative paths, when you shift your app/HTML5, then the relative links won't go with it. If you're using absolute paths, then it should find it, as long as it has access to the link (i.e. if your path is linking to you hard-drive, and you're accessing your HTML5 online from a different computer, then it will look on the computer you're using, not the one you've stored them on.
Can you post some code here showing how you're referencing?
XdM
If you are using relative paths, when you shift your app/HTML5, then the relative links won't go with it. If you're using absolute paths, then it should find it, as long as it has access to the link (i.e. if your path is linking to you hard-drive, and you're accessing your HTML5 online from a different computer, then it will look on the computer you're using, not the one you've stored them on.
Can you post some code here showing how you're referencing?
XdM
Re: HTML linking to referenced images
Hi
For standalones, including HTML5, you will need to include your resources in the Copy Files pane of the Standalone Application Settings and then ensure the references you are using are correct. These can be relative or absolute paths, using specialFolderPath("resources") is often the easiest way to build the paths to the files in a standalone.
I hope that helps.
Elanor
For standalones, including HTML5, you will need to include your resources in the Copy Files pane of the Standalone Application Settings and then ensure the references you are using are correct. These can be relative or absolute paths, using specialFolderPath("resources") is often the easiest way to build the paths to the files in a standalone.
I hope that helps.
Elanor
Elanor Buchanan
Software Developer
LiveCode
Software Developer
LiveCode
Re: HTML linking to referenced images
I realised that I was referencing the absolute paths. What is the easiest way to change them all?
Currently theyre in
C:\Users\XXX\Dropbox\Game\LiveCode files\General\example.png
I've started going through by hand and changing the files to relative paths
\General\example.png
Is there a script that can do it all at once? And where/how do I implement it?
Thank you!
Currently theyre in
C:\Users\XXX\Dropbox\Game\LiveCode files\General\example.png
I've started going through by hand and changing the files to relative paths
\General\example.png
Is there a script that can do it all at once? And where/how do I implement it?
Thank you!
Re: HTML linking to referenced images
Can you help me figure out specialFolderPath("resources")? I can't seem to make heads or tails of it.elanorb wrote: ↑Fri Nov 06, 2020 1:21 pmHi
For standalones, including HTML5, you will need to include your resources in the Copy Files pane of the Standalone Application Settings and then ensure the references you are using are correct. These can be relative or absolute paths, using specialFolderPath("resources") is often the easiest way to build the paths to the files in a standalone.
I hope that helps.
Elanor
Re: HTML linking to referenced images
Hi
The specialFolderPath("resources") function will give you the path to the folder that contains the resources you included in the Copy Files pane. You can use this to set the paths to the images etc. You could do this in preOpenStack or preOpenCard e.g.
I hope that helps.
Kind regards
Elanor
The specialFolderPath("resources") function will give you the path to the folder that contains the resources you included in the Copy Files pane. You can use this to set the paths to the images etc. You could do this in preOpenStack or preOpenCard e.g.
Code: Select all
on preOpenCard
set the filename of image "example" to (specialFolderPath("resources") & "/General/example.png")
... do the rest of the images
end preOpenCard
Kind regards
Elanor
Elanor Buchanan
Software Developer
LiveCode
Software Developer
LiveCode
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: HTML linking to referenced images
All the above sounds so complicated I would just import them into the stack.
-
- VIP Livecode Opensource Backer
- Posts: 7229
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: HTML linking to referenced images
It isn't really. Think of specialFolderPath as a variable holding a path to specific folder. That's all it is, and LC does the work for you figuring out where that folder is on every OS.richmond62 wrote: ↑Fri Nov 06, 2020 7:43 pmAll the above sounds so complicated I would just import them into the stack.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com