Jump to content


Photo

Php call function with alt load.


  • Please log in to reply
4 replies to this topic

#1 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 24 August 2006 - 02:31 PM

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 August 2006 - 02:37 PM

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.

#3 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 24 August 2006 - 02:55 PM

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=

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 24 August 2006 - 04:47 PM

Whats the path that $PRODUCTIMAGES holds?

You might want to do this:
$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">


#5 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 24 August 2006 - 05:41 PM

Haha, well its pulling the  members photo fine now but sill comes up empty when there is no pic?

Heres how i placed it.
<? $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">

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"];






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users