Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts

    Paths - images not showing

    Hi there,

    Basicly, on my website I have an img tag which links to a .php file which displays a random image from a specified directory.

    When I type the adress of the PHP file in the browser, the images display. However, on the page with the img tag, nothing shows.

    Here's my folder structure:

    Page with img tag: cms/themes/test/template.php
    Img file: cms/themes/test/images/gallery/img.php
    Images: cms/themes/test/images/gallery/

    Code:
    <img id="img" src="<?=$pth['folder']['templateimages']?>/gallery/img.php" alt=""/>
    PHP Code:
    <?php 
    $folder 
    '.';
    $images glob$folder '/*.{jpg,JPG,gif,png}'GLOB_BRACE );
    $image  basename$imagesarray_rand$images ) ] );
    echo 
    '<img src="' $folder '/' $image '" alt="' .Gallery'" />'
    ?>
    I've tried to modify the paths both in the php file and on the page - nothing happens.
    Last edited by CaptainB; 09-28-2009 at 08:59 AM.

  • #2
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    does your server have short tags on?

  • #3
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    If this is what you're refering to, then yes:

    Code:
    <img id="img" src="<?=$pth['folder']['templateimages']?>/gallery/img.php" alt=""/>
    Last edited by CaptainB; 09-26-2009 at 08:41 PM.

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    What is the parsed output?

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    I guess the short_open_tags are disabled on your server and so you need to use
    PHP Code:
    <?php echo  $pth['folder']['templateimages']; ?>
    there.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Abdura: I don't think that's the problem. I'm working on a local xampp server, and it doesn't make any difference if I use that or the other.

    If I rightclick on the red cross - where the image should be - the parsed path is: /cms/templates/test/images/gallery/img.php - which is the correct file to the img.php which generates the images. Do I enter the direct path to the img.php file and view that file in the browser, the images are displayed.

  • #7
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Nevermind - I used another script which worked.
    http://www.cmsimple.dk/forum/viewtop...0e2fd8c9e449c7


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •