LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to include a jpg file in a project (where to locate the file)

Inside of my main VI - I am "building a path to the current VIs" directory where I have a jpg file. This jpg file displays fine when running this VI.  To do this I get the current path, strip the VI name and then add the jpg name to the path.
 
Now when I build an exe file and run it the jpg is not displayed.  In the build specification it appears to force the jpg file to be in the support (or data) directory.   Because of this it can no longer find the jpg when running in exe form.  I also notice that the path returned when running a exe includes the VI name as well as the exe name.
 
     My question is what is the correct way to set up a path to this jpg (and perform an exe build) that will work both when I run the VI normally and when I use it as an exe?
 
0 Kudos
Message 1 of 6
(3,172 Views)

See e.g.: http://forums.ni.com/ni/board/message?board.id=170&message.id=270985#M270985

Another option would be to add the image data as a diagram constant inside the VI if it the image should be an integral part of the VI. :).

Message 2 of 6
(3,168 Views)
See the attached VI.
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 6
(3,152 Views)
Thank you very much Altenbach.
I had put a debug path to my VI screen before I posted and could see that I needed to strip the path twice with the exe. and I appreciate the example that made it easy for me to see how to accomplish this.
 
    The other part of my question was in the build specification how to place the *.jpg file's source?
 
If left to itself the build puts it in the data directory.  I can see where I could append "data" to my path if exe is true.  Do I need to do this?
When I try to force the *.jpg file to be located "same as caller" the build still puts it in the data directory?  Is there a way to have the build specification put the *.jpg/s in the same dirctory as the exe?   Does it matter? 
0 Kudos
Message 4 of 6
(3,129 Views)
I assume you're using 8.5 if you don't see the top level destination there by default. I'm not sure why they took this out of the application builder, but you can add it back in. Go to the "Destinations" category on the left. Hit the "+" button at the bottom to create a new destination. Give it a name and set it to the top level of your build directory. Then in the source file settings category, you can set the destination of your jpg to what you just created and it will be placed in the top level.
0 Kudos
Message 5 of 6
(3,121 Views)

Yes I am using 8.5.

Your answer is much appreciated and it worked great!

Thanks

0 Kudos
Message 6 of 6
(3,110 Views)