Embedding linked images, and general mobile workflow...
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 44
- Joined: Wed Feb 13, 2013 3:38 pm
- Contact:
Embedding linked images, and general mobile workflow...
Hi again.
Quite simply - how do I embed a linked image? Say I wanted to wrap the whole thing up for iOS but I had a few linked images. How do I embed them after I have linked them? I have been linking images from development media folders thinking I could embed them all once done (I sometimes do this in Director). But when I publish to iOS the links break and the media doesn't appear so I can't preview my work. Still trying to get to grips with Livecode workflow (coming from Director). Not too sure in Livecode how to best organise media eg. large maps which don't need loaded unless used.
Any wisdom appreciated.
Kind regards, Paul.
Quite simply - how do I embed a linked image? Say I wanted to wrap the whole thing up for iOS but I had a few linked images. How do I embed them after I have linked them? I have been linking images from development media folders thinking I could embed them all once done (I sometimes do this in Director). But when I publish to iOS the links break and the media doesn't appear so I can't preview my work. Still trying to get to grips with Livecode workflow (coming from Director). Not too sure in Livecode how to best organise media eg. large maps which don't need loaded unless used.
Any wisdom appreciated.
Kind regards, Paul.
Re: Embedding linked images, and general mobile workflow...
Hi Paul,
basically you "put" the imagefile (the fielname) of that image INTO that image
I have a little script which does it for me, so I can use (and modify) referenced
images and before deployment I "import" then into the stack.
It just loops through the stack and all cards, and "imports" every referenced image.
Best
Klaus
basically you "put" the imagefile (the fielname) of that image INTO that image

I have a little script which does it for me, so I can use (and modify) referenced
images and before deployment I "import" then into the stack.
It just loops through the stack and all cards, and "imports" every referenced image.
Code: Select all
on mouseUp
## This line is optional
set the defaultstack to "name of your stack here"
lock screen
lock messages
repeat with i = 1 to the num of cds
set cursor to busy
repeat with k = 1 to the num of images of cd i
put the filename of image k of cd i into tImageFileName
## Only process referenced images!
if tImageFileName = empty then
next repeat
end if
## Import the file into stack
put url("binfile:" & it) into image k of cd i
end repeat
end repeat
unlock screen
unlock messages
answer "Done!" & CR & "Don't forget to save stack" && QUOTE & auswahl & QUOTE & "!"
end mouseUp
Klaus
-
- Posts: 44
- Joined: Wed Feb 13, 2013 3:38 pm
- Contact:
Re: Embedding linked images, and general mobile workflow...
Excellent Klaus - danke sehr!
-
- Posts: 44
- Joined: Wed Feb 13, 2013 3:38 pm
- Contact:
Re: Embedding linked images, and general mobile workflow...
Ok so I can't in fact get this to work - it doesn't embed the file but just loses the reference. It has to do with the fact the following I think:
put the filename of image 1 of cd 1
./Media/bg01.png
put the defaultFolder
/Applications
Your routine has the following line:
put url("binfile:" & it) into image k of cd i
The documentation says (about binfile):
"The binfile scheme indicates a binary file which is located on the user's system. The file is specified by either a full path starting with "/", or a relative path starting from the defaultFolder."
The documentation also says (about defaultFolder):
"When a LiveCode application starts up, the defaultFolder initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the defaultFolder before using relative paths.
...
If you specify a file without giving its full path, LiveCode looks for the file in the defaultFolder. If you specify a relative path, the defaultFolder is prepended to it to create the full path."
So I'm creating a bad path. I have a folder called Media next to my Livecode source file. How do I point to this directory? In Director I use 'the moviePath" which returns the directory of the authoring file, then append the local directory. Sorry - still getting to grips with the syntax...
Kind regards, Paul.
put the filename of image 1 of cd 1
./Media/bg01.png
put the defaultFolder
/Applications
Your routine has the following line:
put url("binfile:" & it) into image k of cd i
The documentation says (about binfile):
"The binfile scheme indicates a binary file which is located on the user's system. The file is specified by either a full path starting with "/", or a relative path starting from the defaultFolder."
The documentation also says (about defaultFolder):
"When a LiveCode application starts up, the defaultFolder initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the defaultFolder before using relative paths.
...
If you specify a file without giving its full path, LiveCode looks for the file in the defaultFolder. If you specify a relative path, the defaultFolder is prepended to it to create the full path."
So I'm creating a bad path. I have a folder called Media next to my Livecode source file. How do I point to this directory? In Director I use 'the moviePath" which returns the directory of the authoring file, then append the local directory. Sorry - still getting to grips with the syntax...
Kind regards, Paul.
-
- Posts: 44
- Joined: Wed Feb 13, 2013 3:38 pm
- Contact:
Re: Embedding linked images, and general mobile workflow...
I have resolved this. It was to do with the 'it' keyword as the filename in the line:
url("binfile:" & it)
I replaced 'it' with tImageFileName and it works. This slightly modified script now works for me:
Kind regards, Paul.
url("binfile:" & it)
I replaced 'it' with tImageFileName and it works. This slightly modified script now works for me:
Code: Select all
on doEmbedLinkedMedia
lock screen
lock messages
repeat with i = 1 to the num of cds
set cursor to busy
repeat with k = 1 to the num of images of cd i
put the filename of image k of cd i into tImageFileName
## Only process referenced images!
if tImageFileName = empty then
next repeat
end if
## Import the file into stack
put url("binfile:" & tImageFileName) into image k of cd i
put "card"&&i&&"image"&&k&&"embedded!"
end repeat
end repeat
unlock screen
unlock messages
answer "Done!" & CR & "Don't forget to save stack!"
end doEmbedLinkedMedia
Re: Embedding linked images, and general mobile workflow...
Hi Paul,
ah, oh, yes, the script is from a time, where Livecode did not support relative filenames of images
Best
Klaus
ah, oh, yes, the script is from a time, where Livecode did not support relative filenames of images

Best
Klaus