Gregg Posted August 24, 2006 Share Posted August 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/18543-php-call-function-with-alt-load/ Share on other sites More sharing options...
wildteen88 Posted August 24, 2006 Share Posted August 24, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/18543-php-call-function-with-alt-load/#findComment-79852 Share on other sites More sharing options...
Gregg Posted August 24, 2006 Author Share Posted August 24, 2006 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= Quote Link to comment https://forums.phpfreaks.com/topic/18543-php-call-function-with-alt-load/#findComment-79864 Share on other sites More sharing options...
wildteen88 Posted August 24, 2006 Share Posted August 24, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/18543-php-call-function-with-alt-load/#findComment-79920 Share on other sites More sharing options...
Gregg Posted August 24, 2006 Author Share Posted August 24, 2006 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"]; Quote Link to comment https://forums.phpfreaks.com/topic/18543-php-call-function-with-alt-load/#findComment-79946 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.