I am trying to include images in a maintain. The images are not stored in the application's directory but an images directory that will be shared with all application. When I add the image from the images directory by dragging and dropping it to the form and deploy the maintain the path that shows for the broken image is:
So not only does the directory change but so does how the server revers to itself. It replaces localhost with the servers IP. So when the IP is used the image appears but when it uses localhost it does not.
How can I resolve this so that all the images for my maintain can be in one directory?
--------------- Webfocus 7.7.1 WinServer 2008This message has been edited. Last edited by: Kerry,
October 01, 2010, 11:50 AM
When I add an image to my form, after selecting it and clicking Finish, I get a prompt that says: Before opening this file a copy must be made in the project directory.
This is why, when you run from inside the MDE, you should see the image and the property should be: localhost/approot/appname/imagename
Then, when you use the deployment tool, whatever server/path that you use there should replace the localhost in the properties.
If you DO want to use one specific directory for all of the images, I recommend using a variable with an image path for the pictures. For example, in my code I have: Compute Pic/a100 = '/approot/maintain/images/book.gif'; When I deploy / run Maintain resolves the variable and I see my image. In this way I can store the names in a database as well. The only drawback to this is that you don't see the images when developing in the MDE.
October 03, 2010, 09:23 PM
While writing a line of code, for each image, in all Maintains, may work, it feels like a workaround to me, and additional work.
Are you sure there isn't another way to get the MDE to write the correct URL for the images ?
WebFocus/Maintain 7.6.4-8 on Win2000 and 2003 Server
October 04, 2010, 08:33 AM
Dave When you use the deployment tool, you select where the images get copied to. At that point Maintain replaces the current image path in the MNT file with whatever path you are assigning. If you have a specific directory on the server that you want your images to reside in, add that to your deployment scenario and the url should be taken care of automatically.
I just suggested the image path idea, because many of our clients like the idea of keeping that information in a database.
October 04, 2010, 09:17 AM
If you have a specific directory on the server that you want your images to reside in, add that to your deployment scenario and the url should be taken care of automatically.
How is this done? I am only able to deploy to the application's directory. How do I specify another directory that's on the same level as the applications directory?
root -my_app_dir -other_app -another_app -images
October 04, 2010, 12:12 PM
When you are in a deployment scenario, all of the Application files are on the left, and the Available Servers are on the right. You should see your Webserver as: Web/appname Where appname is the name of the application you are deploying your resource files to. If you right click on the WEB server name you can select New Folder and add a subfolder there. If you drag your Image files to there, they will get placed there when deployed.
When you run, the image properties will point to the sub-directory.
October 04, 2010, 03:04 PM
If I right click Web/appname and add images won't that create an images sub-directory in the appname directory. How is this going to point to the images directory on the same level as the appname directory?
-Root --Images --Appname -----Images
October 05, 2010, 12:25 PM
The issue here is that the deployment tool only allows you to deploy resource files to one Web server path. To do what you are requesting would require the ability to deploy to multiple paths. We do allow you to deploy to a sub-directory, but not to a parallel one.
The only solution that I can offer you is to create an image path for each image. When you place the image on the form, use a variable to display its location. This variable can be hardcoded or come from a database.
I can submit your case as an NFR, but I do not know if we could add this functionality.
October 07, 2010, 05:22 PM
Let's say that the same directory structure is created in Dev. Studio, and on the Reporting server:
root (IBI/Apps) -- Images -- Scripts -- Project1
The Images, Scripts, and Project1 projects would then be deployed to the Server separately.
Wouldn't the file paths be created properly when the Maintain app. in Project1 is deployed ?
WebFocus/Maintain 7.6.4-8 on Win2000 and 2003 Server
October 12, 2010, 10:38 AM
Dave When an image is placed on a form, it is copied into the project. When run locally, you will see that the image's properties are not from the directory that it was added from, but the current project. When we deploy to another server, if you deploy the images, the address / path is replaced with the server / path that you are deploying it to. The MDE only allows for one path at this point.
Now, there IS an option to NOT deploy the image, and ONLY use the path, but no way to redirect the URL to another image directory at this point. So, the only 2 ways I can think to accomplish this is to:
1) Edit the mnt file by hand before deployment. Replace the path to the image, and then at deploy time, do not deploy the image. If you don't deploy then the path that you hard-coded will be respected.
2) Use a variable with an image path when placing the image on the form.
October 12, 2010, 04:04 PM
We put everything in ibi_html/images and direct link it via url in the Top case of the Maintain. All the checkboxes and bullets and arrows get used in a dozen places so it's the most straightforward way to get a hold of everything we need from everywhere it's needed. We use the same images in focexecs that support the Maintain app and even on static pages so it keeps everything very simple and easy.
I suppose you could have a sensitive image that shouldn't be available to everyone but we haven't run into that yet.
This may not as slickey as it could be, but it is super-easy and super-dependable. We also never deploy them -- having multiple Maintains deploying the same file is NOT pretty if something has to change. Drop them there and link to them.