• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Static Images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Static Images


  • Subject: Re: Static Images
  • From: Art Isbell <email@hidden>
  • Date: Tue, 24 Jun 2003 10:48:35 -1000

I don't have a lot of experience with Web images and no experience converting an existing Web site to WO, so please correct any misconceptions I have.

On Tuesday, June 24, 2003, at 08:39  AM, Goodbye Bill wrote:

1. If I add a static image to the page, what should the relative URL be to
the image? This should be the same for everyone using WebObjects.

For a static image, the path to the image is relative to the Web server document root. This is true for all Web sites, not just WO sites. A static WOImage is just a IMG tag that isn't processed by WO as is a dynamic WOImage which is represented by a WEBOBJECT tag and WOImage wod entry.


2. If resources must be added to the project, where and how should they be
added?

It's not necessary to add images to a WO app project, especially if these images already exist in the Web server doc root. However, if they're not added to the project, they probably won't be displayed in developer (i.e., direct connect) mode in which no Web server is used.


If you add them to your project, their relative path will change to something like /WebObjects/<YourApp.woa>/Contents/WebServerResources. This relative path will be valid after you do a Web server install, but if these images are already in the Web server doc root, why create duplicate copies of them?

One option is to add images individually. But I believe you said that you added an entire directory of images. To do this correctly, you must create a folder reference (blue) instead of recursively creating groups (beige) in PBX. This is an option when you add files to a project. These images should be added to WebServerResources with the "Web Server" target checked since they won't be used to build the "Application Server" target.

3. Do I have to use a control for each image or should WebObjects notice the
"img" tag and convert the "src" property?

If you have an existing HTML page with IMG tags, just leave them alone and WO should ignore them.


I have an existing site that was built outside of WebObjects. It uses a lot
of images within each page but some elements of each page are dynamic. I am
porting it to WebObjects (obviously). I would like to use the images on the
page without having to convert every single image to a WOImage control.

Then don't change the IMG tags. WOBuilder will display the image if SRC is a full path and will display a broken image for a relative path.


A. I have added ALL images to my project, under "Web Server Resources," as
well as a static copy on the sever. Here are the paths to the images:


    Physically on my hard drive:
    /Users/<userdir>/Projects/MyApp/Images

    In Project Builder:
    MyApp/Web Server Resources/Images
    (the directory and contents are all set to the Web Server target)

    Physically on my server's hard drive:
    /Library/WebServer/Documents/Images

    The location of the web server's root directory:
    /Library/WebServer/Documents

B. I have attempted to add a static image to my page. I have done this by:

    i. Opening a new page and adding a WOImage to the page;

ii. In the inspector, click the "Make Static" button for the WOImage;

    iii. In the inspector, select "Doc Relative" for the image.

    AT THIS POINT:
    1. The resulting page shows the following image now in the page:

<IMG SRC="../Images/myimage.gif">

You should point to the image in the Web server doc root instead.

2. The image IS visible within Project Builder.

Yep. The above relative path is valid.


3. The image is NOT visible when doing a "Build and Debug." The URL
to the image still shows the same relative path as above.

The above relative path is no longer valid because the app is in the project's "build" directory. A static image's relative path should be relative to the Web server's doc root.


D. I have attempted a deployment/install of the project using the following
syntax:


    sudo pbxbuild install DSTROOT=/ -buildstyle Deployment
    sudo pbxbuild install DSTROOT=/ -buildstyle WebServer

    AT THIS POINT:
    Nothing changes.  See B3, above.

This would work had you used paths relative to the Web server doc root.

Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Static Images (From: Goodbye Bill <email@hidden>)

  • Prev by Date: Re: Static Images
  • Next by Date: Re: Web Services on Windows OS
  • Previous by thread: Re: Static Images
  • Next by thread: Re: Static Images
  • Index(es):
    • Date
    • Thread