Jump to content

displaying a default image ;x


suess0r

Recommended Posts

hey guys,

i'm setting up a site and some of my records have pictures and some don't, but i want the ones that don't to have some sort of mmpf to them as well, other than the generic [x] image not found space. is there any way i can default to a certain image if the ($i.jpg) doesn't exist??? thanks  :D
Link to comment
Share on other sites

thanks semi, i'm getting this error though...

Parse error: parse error, expecting `','' or `';'' in /Users/jif/Clb411/pg3.php on line 9
[quote]
$file = "/images/clubs/logos/'.$name.'.jpg";
echo (file_exists($file)) ? "<img src='$file' alt='My Image' />" : "<img src='/images/noimg.jpg' alt='No Image' />";[/quote]

any thoughts?
Link to comment
Share on other sites

that is the code... and it is line 9 ;x

<?php
$file = "/images/clubs/logos/'.$name.'.jpg";
echo (file_exists($file)) ? "<img src='$file' alt='My Image' />" : "<img src='/images/noimg.gif' alt='No Image' />";
?>

i think there's an error in the syntax with the ' or the "'s somewhere.
Link to comment
Share on other sites

OK, so i don't think that syntax was the problem....there was a previous echo before it, and now how it is I don't know how to close this echo...

echo '
<tr>';
$file = "/images/clubs/logos/$name.jpg";
echo (file_exists($file)) ? "<img src='$file' alt='My Image' />" : "<img src='/images/noimg.jpg' alt='No Image'
Link to comment
Share on other sites

ok, so it's only displaying the default noimg.jpg no matter what (even that I know a lot of the pictures do exist) here's what the code is, am i setting the $file wrong??

[quote]echo '
<tr>';
$file = "/images/clubs/logos/$name.jpg";
echo (file_exists($file)) ? "<p align='center'><img src='$file' alt='My Image' />" : "<img src='/images/noimg.jpg' alt='No Image'/></p>";[/quote]

appreciate the assitance...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.