This discussion is archived
11 Replies Latest reply: Feb 14, 2013 10:36 PM by Gus C RSS

Display Images Using Substitution Strings

Gus C Journeyer
Currently Being Moderated
Using Apex 4.2

I want to hold my images, css and javascript on the file system.
I have created 3 new folders called
havi_apex_images
havi_apex_javascript
havi_apex_css

I have placed my images, css and javascript in the appropriate folders.
I have created 3 new substitution called
HAVI_IMAGES
HAVI_JAVASCRIPT
HAVI_CSS
and entered the correct file paths in the Substitution Values.

In my page header, I have put
<link rel="stylesheet" href="&HAVI_CSS.DWH1.css" type="text/css" />
<script type="text/javascript" src="&HAVI_JAVASCRIPT.image_slide.js"></script>
These work, but my problem is the images
I have tried to use the following in another page
<center><img src="&HAVI_IMAGES.HL-Logo.gif"></center>
but the image is not displayed.

Have I missed a step ?

Gus
  • 1. Re: Display Images Using Substitution Strings
    fac586 Guru
    Currently Being Moderated
    Gus C wrote:
    Using Apex 4.2

    I want to hold my images, css and javascript on the file system.
    I have created 3 new folders called
    havi_apex_images
    havi_apex_javascript
    havi_apex_css

    I have placed my images, css and javascript in the appropriate folders.
    I have created 3 new substitution called
    HAVI_IMAGES
    HAVI_JAVASCRIPT
    HAVI_CSS
    and entered the correct file paths in the Substitution Values.

    In my page header, I have put
    <link rel="stylesheet" href="&HAVI_CSS.DWH1.css" type="text/css" />
    <script type="text/javascript" src="&HAVI_JAVASCRIPT.image_slide.js"></script>
    These work, but my problem is the images
    I have tried to use the following in another page
    <center><img src="&HAVI_IMAGES.HL-Logo.gif"></center>
    but the image is not displayed.
    What code gets generated in the rendered page? What actually gets displayed in the rendered page? Where is this code used? Is it somewhere that supports static text substitution strings?

    Note that the <tt>center</tt> element has been deprecated since forever, and is now obsolete. <tt>alt</tt> is also a mandatory attribute on <tt>img</tt> elements (even if it's empty). Depending on where you're using this, conforming options are something like:
    <div style="text-align: center;"><img src="&HAVI_IMAGES.HL-Logo.gif" alt=""></div>
    or
    <img src="&HAVI_IMAGES.HL-Logo.gif" style="display: block; margin: 0 auto;" alt="">
  • 2. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    When I do a page source I can see the call for the image with the correct file path.
    When I run the page no image is dispalyed. I just get the blank image with the red cross.

    If I load the image into apex and use
    <div style="text-align: center;"><img src="#WORKSPACE_IMAGES#HL-Logo.gif" alt=""></div>
    Then it displays ok.


    Gus

    Edited by: Gus C on Feb 13, 2013 3:48 AM
  • 3. Re: Display Images Using Substitution Strings
    fac586 Guru
    Currently Being Moderated
    Gus C wrote:
    When I do a page source I can see the call for the image with the correct file path.
    When I run the page no image is dispalyed. I just get the blank image with the red cross.
    Can you access the images directly by typing the <tt>src</tt> URL into the browser address bar?

    Check file permissions on the images and the preceding folders in the file path to them.

    Depending on web server and host OS, check the virtual directory set up in the web server, and for case-sensitivy in the image URLs, filenames and file path.
  • 4. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    Permissions are the same for all 3 folders and I have no problems with the other 2

    Gus
  • 5. Re: Display Images Using Substitution Strings
    fac586 Guru
    Currently Being Moderated
    Gus C wrote:
    Permissions are the same for all 3 folders and I have no problems with the other 2
    Check the web server access/error logs.
  • 6. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    I won't be able to do that until tomorrow.
    I just moved the code to the Region Source of my region, instead of the header and inspected it with firebug.
    I cannot see the code in firebug


    Gus
  • 7. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    Not able to get access to the log files

    Any other suggestions ?

    Gus
  • 8. Re: Display Images Using Substitution Strings
    fac586 Guru
    Currently Being Moderated
    Gus C wrote:
    Not able to get access to the log files

    Any other suggestions ?
    No, I've covered the most common problems I've previously encountered. To understand what's actually going on you need to see the logs.

    Can you display an image if it's located in the CSS or JS folders?
  • 9. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    It turns out that none of my substitutions are working.
    Is there a recommended place to put the folders ?

    Gus
  • 10. Re: Display Images Using Substitution Strings
    fac586 Guru
    Currently Being Moderated
    Gus C wrote:
    It turns out that none of my substitutions are working.
    Well I can't say I'm all that surprised.
    Is there a recommended place to put the folders ?
    No, but it's not just a case of creating folders. See my earlier post:
    Depending on web server and host OS, check the virtual directory set up in the web server
    Usually the physical folders in the host file system have to be exposed to the web as virtual folders in the web server.

    What web server and host OS are you using? (Note that if it's not OHS/Apache on Linux/UN*X I'm unlikely to be of much further help.)

    I suspect that if you don't have access to the server logs, you don't have access to configure virtual directories either...
  • 11. Re: Display Images Using Substitution Strings
    Gus C Journeyer
    Currently Being Moderated
    Thanks for all your help.

    Gus

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points