View Full Version : Resolved Paths - images not showing

09-26-2009, 08:47 PM
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/

<img id="img" src="<?=$pth['folder']['templateimages']?>/gallery/img.php" alt=""/>

$folder = '.';
$images = glob( $folder . '/*.{jpg,JPG,gif,png}', GLOB_BRACE );
$image = basename( $images[ array_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.

09-26-2009, 09:13 PM
does your server have short tags on?

09-26-2009, 09:34 PM
If this is what you're refering to, then yes:

<img id="img" src="<?=$pth['folder']['templateimages']?>/gallery/img.php" alt=""/>

09-27-2009, 03:13 PM
What is the parsed output?

09-27-2009, 03:46 PM
I guess the short_open_tags are disabled on your server and so you need to use
<?php echo $pth['folder']['templateimages']; ?> there.

09-27-2009, 06:30 PM
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.

09-28-2009, 09:59 AM
Nevermind - I used another script which worked.