Ist ja an sich nicht schwer ... wo bzw. wie werden die Bilder gespeichert?
Befinden sich die Pfade wie das Avatar in der Datenbank?
Ich habe mal ein mögliches
Beispiel aufgebaut!
Hierfür wäre es notwendig, dass das Profilbild und Titelbild in der Datenbank unter
prefix_user als
titelbild und
profilbild mit dem Pfaden
include/images/titelbild/ und
include/images/profilbilder/ gespeichert werden.
Auch sollte es in diesen Pfaden für den Code ein Bild geben, sofern ein
User kein Bild hinterlegt hat (
dummy.jpg) und für
Gäste (
gast.jpg) geben.
Hier mal das Codebeispiel:
profilheader1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | <?php
defined ( 'main' ) or die ( 'no direct access' );
if (loggedin()) {
$row = db_fetch_object(db_query( 'SELECT `profilbild`, `titelbild` FROM `prefix_user` WHERE `id` = ' . $_SESSION [ 'authid' ]), 0);
$titelBild = '' ;
if (! empty ( $row ->titelbild) && file_exists ( $row ->titelbild)) {
$titelBild = $row ->titelbild;
} else {
$titelBild = 'include/images/titelbilder/dummy.jpg' ;
}
$profilBild = '' ;
if (! empty ( $row ->profilbild) && file_exists ( $row ->profilbild)) {
$profilBild = $row ->profilbild;
} else {
$profilBild = 'include/images/profilbilder/dummy.jpg' ;
}
$ILCH_HEADER_ADDITIONS .= '
<style type= "text/css" >
.titelBild {
margin:0;
padding:0;
position:absolute;
left:50%;
margin-left:-658px;
top:30px;
width:1316px;
height:315px;
text-align:center;
z-index:0;
background:url( ' . $titelBild . ' );
}
.profilBild {
border:0;
position:absolute;
bottom:-40px;
left:40px;
width:188px;
height:188px;
}
</style>';
echo '<div class="titelBild"><img class="profilBild" src="' . $profilBild . '" alt="Profilbild" /></div>' ;
} else {
$ILCH_HEADER_ADDITIONS .= '
<style type= "text/css" >
.titelBild {
margin:0;
padding:0;
position:absolute;
left:50%;
margin-left:-658px;
top:30px;
width:1316px;
height:315px;
text-align:center;
z-index:0;
background:url( include /images/profilbilder/gast.jpg);
}
.profilBild {
border:0;
position:absolute;
bottom:-40px;
left:40px;
width:188px;
height:188px;
}
</style>';
echo '<div class="titelBild"><img class="profilBild" src="include/images/profilbilder/gast.jpg" alt="Profilbild" /></div>' ;
}
?>
|
Diese Box dann als
include/boxes/profilheader.php speichern und in die
index.htm als
{_boxes_profilheader} einbinden.
PHP Kenntnisse sind auf jedenfall notwendig!
Anpassungen an Form und Aussehen sind natürich auch notwendig.