Wiki source code of How to add an image to a Component
Version 2.1 by Lachlan Scott on 2007/07/12 18:54
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | **Problem:** you want to add an image to the HTML page of a Component; being an highly skilled application developer with the good sense to apply your talents with WebObjects :D , you expect to do this by using the <img src=" "> tag in the HTML, and are confused as to how to achieve it in WebObjects. | ||
2 | |||
3 | **Discussion:** WebObjects provides the WOImage tag to manage images in component pages which obviates the 'img' tag, and which can be somewhat unintuitive for the beginning WO developer. The tag supports all the expected HTML img attributes as far as I can tell; needs checking and the 'filename' attribute which references the location of the image to WebObjects. The images themselves must | ||
4 | |||
5 | **Question:** Yeah, but why can't I just make a static reference in the usual way? Well actually, you can link required, but you don't really want to explanation required: load balancing, web server resources, etc, and the WOImage tag is an elegant solution that you will come to appreciate in time; trust us, we're doctors. Well, some of us are, anyway. :-) | ||
6 | |||
7 | Solution: | ||
8 | |||
9 | * Create a suitable image directory structure in your project | ||
10 | * Import the image into the directory of your choice | ||
11 | * Add the WOImage tag to your page | ||
12 | * Reference the image using the 'filename' attribute | ||
13 | |||
14 | | ||
15 | In the WOLips perspective, double-click the component to which you want to add the image |