How to make a referenced image part of the stack

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

How to make a referenced image part of the stack

Post by 3d-swiss » Fri Apr 20, 2012 9:07 am

Hello again,

I like to use referenced images during the process of design and programming.
But when it come to the standalone version. I like to have the referenced images part of the stack, so that there is no extra folder with the images, which can be deleted and distort the look of the program.

What is the best way to do so?

Have a good weekend.
Jens

P.S. I can enter any folder name in "destination folder" in Copy Files, but I always find the original folder name in the windows folder with the standalone program. It's a bug in 5.5.?

P.P.S.: Which is the best grafic program to use with livecode? I like adobe fireworks (on mac) most.
Is there a other program like fireworks for win, which can handle .png in the same way?

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to make a referenced image part of the stack

Post by Klaus » Fri Apr 20, 2012 11:33 am

Hi Jens,

I have a little script for exact that purpose!
I use referenced images, so you can excahnge and modify them during development
and then import them before building a standalone.

You could even add this to a "savingstandalone" handler, see dictionary, of your main-/standalone stack!

It simply loops through all your cards in a give stack and will "import! all referenced iamges:

Code: Select all

command import_referenced_images
  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
      get the filename of image k of cd i
      if it = empty then 
         next repeat
      end if
      put url("binfile:" & it) into image k of cd i
    end repeat
  end repeat
  unlock screen
  unlock messages
end import_referenced_images
P.S.
No bug!
That's the way it works, all the files and folders will be copied to the folder
where the runtime sits, which is not so cute on Windows where you can see
all the files and folders, as on the Mac where everything goe nicely into the
application package!

I'm not sure what you are exspecting?

P.S.
If you need to do graphic work on Windows, too, there is also FireWorks for Windows :-)
I do all my graphics work on my Mac ;-)


Best

Klaus

3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

Re: How to make a referenced image part of the stack

Post by 3d-swiss » Fri Apr 20, 2012 3:46 pm

Allegra Klaus,
thanks for your answer. But it doesn't not work.

I tried this:

Code: Select all

   put field "fPfad" into tPath  # get the path of an image (i.e. with answer file)
   put empty into image 1 # clear the image
   put url ("binfile:" & tPath) into image 1 # take the new image
   put tPath into field "fPfad" # show the path for testing
A image with a path like "/Users/jens105/Desktop/unterordner/bild1.png" will shown in my stack, but a path like "./unterordner/bild1.png" not.
The second path will be generate by your script and so i will loose all images.

P.S. When I can name a destination folder "referenced files" I expect that all ref. files will be in that folder (like InDesign collect all files in a folder called "link). Silly me?

P.P.S. I know that fireworks is on Windows too, but the program is not free at all. Can't believe that there is no other program, hat can work with .png like Fireworks.

Have a good weekend.
Jens
Attachments
Bildschirmfoto 2012-04-20 um 16.42.14.png

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: How to make a referenced image part of the stack

Post by snm » Fri Apr 20, 2012 4:24 pm

Fireworks for mac is not free also (like for win). You asked for "best graphic program" - it'll be never free.

Marek

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to make a referenced image part of the stack

Post by Klaus » Fri Apr 20, 2012 4:36 pm

Hi Jens,
3d-swiss wrote:A image with a path like "/Users/jens105/Desktop/unterordner/bild1.png" will shown in my stack, but a path like "./unterordner/bild1.png" not.
The second path will be generate by your script and so i will loose all images.
ah, yes, sorry, this will only work wih absolute filepathnames.
But you could do this before the repeat loop:

Code: Select all

...
put the filename of stack "your stack with relativ image pathname here" into tRoot
set itemdel to "/"

## Delete stack filename, so we get the missing piece in relative pathnames :-)
delete item -1 of tRoot
... 
## Then in the repeat loop:
...
 repeat with k = 1 to the num of images of cd i
      put the filename of image k of cd i into tImageFile

     ## "there is a file...." will only work with absolute pathnames!
     ## Try to convert to ABSOLUTE path
      if there is not a file tImageFile then
         put tRoot into item 1 of tImageFile
     end if
     ## Give up :-)
      if there is not a file tImageFile then
         next repeat
      end if
      put url("binfile:" & tImageFile) into image k of cd i
    end repeat
...
Out of my head, but you get the picture :)
3d-swiss wrote:P.S. When I can name a destination folder "referenced files" I expect that all ref. files will be in that folder (like InDesign collect all files in a folder called "link). Silly me?
No, this is just a placeholder for the actual foldername where the standalone will copied to by the enduser!
Win only, on the Mac everything goes cleanly into the app package! :)
3d-swiss wrote:P.P.S. I know that fireworks is on Windows too, but the program is not free at all. Can't believe that there is no other program, hat can work with .png like Fireworks.
No idea, I do all my "serious" work on my Mac ;-)


Best

Klaus

3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

Re: How to make a referenced image part of the stack

Post by 3d-swiss » Sat Apr 21, 2012 4:59 pm

Thanks for the answers.

I will try the code later on ;-)

Have a good weekend.
Jens

pf1973BUS9A4U
Posts: 1
Joined: Thu Apr 19, 2012 12:41 pm

Re: How to make a referenced image part of the stack

Post by pf1973BUS9A4U » Sat May 05, 2012 3:42 pm

Hello Jens,

You have actually asked two questions I believe:
1. How to reference images within a stack
2. What application to use to (edit) manipulate images? (I'm not sure what you're getting at here).

In answer to the first question, my thoughts were that you create a hidden card (sub-stack) that contains all of your images. This is seen in one of the 6 Beginner training videos.. I am not allowed to post the link, but it's on Video number 4. Start watching from 00:02:30. You will see that images are referred to as ID's hence they must be imported and they live in a sub-stack. This would work fine provided the images did not need to change.

As for question 2. Depending on your budget, I could recommend ACDSee as an easy image editor that requires little or no education - very easy to use... Photoshop costs money and requires some education. GIMP is free, but needs an understanding similar to that of photoshop. Ultimately, everyone ends up turning to photoshop... another commercial product is Corel Draw. From my own experience, ACDSee is a cheap and fast image editor that has a lot to offer.
The other quick and easy editor that comes to mind is from CoffeeCup called Web image Studio.

I hope this helps!

Post Reply