/    Sign up×
Community /Pin to ProfileBookmark

images inside functions

Hi all,

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

[code=php]
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);
[/code]

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

Cheers 😮

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 23.2005 — Should the sequence be...
<i>
</i>src='$file_directory/$image'

...?
Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — What defines your [b]$image[/b] and [b]$file_directory[/b]?
Copy linkTweet thisAlerts:
@sandro27authorSep 24.2005 — You are right Nog Dog,I have made a mistake.

I have fixed it and it looks as follows:

[code=php]
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;
[/code]


thanks ?
×

Success!

Help @sandro27 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...