Click to See Complete Forum and Search --> : images inside functions


sandro27
09-23-2005, 02:24 PM
Hi all,

I wonder if it is possible to use the followinh method to display images:


function display_img($image,$file_directory){
echo "<div class='col1'><img src='$image/$file_directory' style='border: 1px solid black;'></div>";
}

//call function;

display_img($image,$file_directory);


In this case I am not having sucess. Hope someone can give me an idea what it is wrong.

Cheers :o

NogDog
09-23-2005, 03:07 PM
Should the sequence be...

src='$file_directory/$image'

...?

Sheldon
09-23-2005, 05:12 PM
What defines your $image and $file_directory?

sandro27
09-23-2005, 09:00 PM
You are right Nog Dog,I have made a mistake.

I have fixed it and it looks as follows:


function display_text($file_directory,$image){
echo "<div class='col1'><img src='$file_directory/$image' style='border: 1px solid black;'></div>";
}

switch($_REQUEST['cmd']){

default:
index();
break;

case "display_text":
display_text("images", "image.jpg");
break;


thanks :)