PHP Classes

File: demo1.php

Recommend this page to a friend!
  Classes of Luciano Salvino   PHP Avatar Stylizer   demo1.php   Download  
File: demo1.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Avatar Stylizer
Detect predominant colors on avatar images
Author: By
Last change:
Date: 6 years ago
Size: 1,063 bytes
 

Contents

Class file image Download
<?php

require __DIR__ . '/PHPAvatarStylizer.php';

$avatarStylizer = new \PHPAvatarStylizer\PHPAvatarStylizer(TRUE);

$avatarPath = 'images/avatarDemo1.jpg';

$userName = 'Lutian_the_Martian';

$userDesc = 'Give Me that Elephant!';

$avatarStylizer->getColorFromImage($avatarPath);

?>
<style>
.bgAvatar {
    background-color: <?php echo $avatarStylizer->bgColor;?>;
    width: 400px;
    height: 140px;
    padding: 20px;
}
.imgAvatar {
    float: left;
    background-image: url('<?php echo $avatarPath;?>');
    width: 120px;
    height: 120px;
    background-size: cover;
    border-radius: 50%;
}
.detailAvatar {
    float: left;
    width: 240px;
}
.title {
    margin-left: 20px;
    color: <?php echo $avatarStylizer->txtColor;?>;
    font-family: Arial;
    font-size: 22px;
}
.desc {
    margin-left: 20px;
    color: <?php echo $avatarStylizer->txtColor;?>;
    font-family: Arial;
    font-size: 16px;
}
</style>
<div class="bgAvatar">
    <div class="imgAvatar"></div>
    <div class="detailAvatar">
        <h2 class="title"><?php echo $userName;?></h2>
        <h3 class="desc"><?php echo $userDesc;?></h3>
    </div>
</div>