Jump to content

Php call function with alt load.


Gregg

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.
Link to comment
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.
Link to comment
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=
Link to comment
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]
Link to comment
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"];

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.