Jump to content

Archived

This topic is now archived and is closed to further replies.

Gregg

Php call function with alt load.

Recommended Posts

Ok, i want to make it so if a person don't upload an photo of them selfs it will load the default in there profile instead of leaving itempty.
I wantedtoknow how toacomplish this.

Here is my call function:
<img name="<?$row1["quote"]?>" src=" <? echo $PRODUCTIMAGES.$photo?>" alt="<?$row1["quote"]?>" border=0 width=180 height=215 align=absmiddle>

Do i just and and "else $images.$default.gif?
Any help wouldbe great. caust it looks horible when no default pic is loaded.

Share this post


Link to post
Share on other sites
Is the $photo hold the path to thier picture. You can probably do this:
$photo = (isset($photo) && !empty($photo)) ? $photo : 'path/to/defualt/image/here.gif';

That checks if $photo is set and that its not empty. If is int i'll use the $photo. Otherwise it set $photo to "path/to/defualt/image/here.gif" Change path/to/defualt/image/here.gif to the location of your defualt profile image.

Share this post


Link to post
Share on other sites
Well i placed it but it dident load eather pic. I tested a profile that had a photo and it was there but blank error and the default was the same.

I use the product images to determin the path to the members pics.
My PHP:
<img name="<?$row1["quote"]?>" src=" <? echo $PRODUCTIMAGES.$photo?>" alt="<?$row1["quote"]?>" border=0 width=180 height=215 align=absmiddle>

My default "No Photo" is located in:
images/No_Photo.gif, is there any way to ad this to the exsisting code??
Under else=

Share this post


Link to post
Share on other sites
Whats the path that $PRODUCTIMAGES holds?

You might want to do this:
[code]$photo = (isset($photo) && !empty($photo)) ? $PRODUCTIMAGES.$photo : 'images/No_Photo.gif';

<img name="<? echo $row1['quote']; ?>" src="<? echo $photo; ?>" alt="<? $row1['quote']; ?>" border="0" width="180" height="215" align="absmiddle">[/code]

Share this post


Link to post
Share on other sites
Haha, well its pulling the  members photo fine now but sill comes up empty when there is no pic?

Heres how i placed it.
[color=red][b]<?[/b][/color] $photo [color=blue]= (isset[/color]($photo) [color=blue]&& !empty[/color]($photo)[color=blue]) ?[/color] $PRODUCTIMAGES[color=blue].[/color]$photo [color=blue]:[/color] [color=red]'images/No_Photo.gif'[/color][color=blue];[/color][color=red] [b]?>[/b][/color]

<img name="[b][color=red]<?[/color][/b] [color=green]echo[/color] $row1['quote']; [color=red][b]?>[/b][/color]" src="[color=red][b]<?[/b][/color] echo $photo; [b][color=red]?>[/color][/b]" alt="<? $row1['quote']; ?>" border="0" width="180" height="215" align="absmiddle">

I check the images/ folder and the pic is there? why wont it pull the default image....

UPDATE!
I got it working lol, i looked at the head code and it said:
if($row1["photo"])
$photo=$row1["photo"];
else
$photo="No_Photo.gif"; <<<< I PLACED IT HERE AND IT WORKSNOW LOL.. I AM SOO STUPID!

  $PRODUCTIMAGES="photoimage/";
  $sql="select * from users where identity='$UsErCoOkIe'";
  $result=mysql_query($sql,$db);
  $row7=mysql_fetch_array($result);
  $id1=$row7["userid"];

Share this post


Link to post
Share on other sites

×

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.