Page 1 of 1

Help!!! I am having problems ...

Posted: Tue Jun 12, 2007 5:52 pm
by bfonseca
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am having problems displaying the actual image using directory functions.  This is the Code:

Code: Select all

$path = "Bobsimages/$event/";
	
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
									
//running the while loop
while ($file = readdir($dir_handle)) {
	if ($file!="." && $file!=".." && $file!="Thumbs.db"){   // <a href='$file'>$file</a><br/>
		echo("<a href='#' onclick=showPreview('Bobsimages/$event/$file','1'); return false\"> $file </a>
			  <img src=\"Bobsimages/$event/$file width=\"95%\" target = \"gol\">");	
	}
}
closedir($dir_handle);
As you can see I am using the opendir() and the readdir() directory functions. I believe the problem to be when I return the entry from the directory. I have a scrollbar and in that scrollbar is where I want these images to appear. Instead of the images, I am getting the name of the images. I do understand why its doing that, however I do not understand how to fix this problem.

On the left is where the scrollbar is and when you click on the image it displays on a screen on the right. I am not using frames (FYI). This all works fine, When I click on the name of the image it does display the right image to the right of it. But I dont want the names to appear I want the image itself.

Is there a directory function that displays the actual image rather then the name of the image? If so then what? If not then how would I fix this problem?

Can anyone help me with this issue please.

Thanks in advance,


Brian Fonseca


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Jun 12, 2007 6:24 pm
by Ollie Saunders
Have a look at the output that code is generating and you will see that you are missing quotes on some of your HTML attributes, this is probably causing your img tag to fail to render.

Posted: Tue Jun 12, 2007 6:53 pm
by bfonseca
Ole,

Hey thanks, that solved my problem. All it took was a fresh set of eyes. Appreciate the help.

Thank you


Brian Fonseca