include_once('fixcaption.php');
$slug = $_GET['slug'];
function filesize_formatted($path)
{
$size = filesize($path);
$units = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = $size > 0 ? floor(log($size, 1024)) : 0;
return number_format($size / pow(1024, $power), 2, '.', ',') . ' ' . $units[$power];
}
function getContrastColor($hexColor) {
// hexColor RGB
$R1 = hexdec(substr($hexColor, 1, 2));
$G1 = hexdec(substr($hexColor, 3, 2));
$B1 = hexdec(substr($hexColor, 5, 2));
// Black RGB
$blackColor = "#000000";
$R2BlackColor = hexdec(substr($blackColor, 1, 2));
$G2BlackColor = hexdec(substr($blackColor, 3, 2));
$B2BlackColor = hexdec(substr($blackColor, 5, 2));
// Calc contrast ratio
$L1 = 0.2126 * pow($R1 / 255, 2.2) +
0.7152 * pow($G1 / 255, 2.2) +
0.0722 * pow($B1 / 255, 2.2);
$L2 = 0.2126 * pow($R2BlackColor / 255, 2.2) +
0.7152 * pow($G2BlackColor / 255, 2.2) +
0.0722 * pow($B2BlackColor / 255, 2.2);
$contrastRatio = 0;
if ($L1 > $L2) {
$contrastRatio = (int)(($L1 + 0.05) / ($L2 + 0.05));
} else {
$contrastRatio = (int)(($L2 + 0.05) / ($L1 + 0.05));
}
// If contrast is more than 5, return black color
if ($contrastRatio > 5) {
return '#000000';
} else {
// if not, return white color.
return '#FFFFFF';
}
}
$conn = mysqli_connect("localhost","root","ftUs3vn9wYTXpnoG9QsJ","logodix");
mysqli_query($conn, "SET NAMES UTF8");
if (mysqli_connect_errno()) {
printf("Connection error: %s\n", mysqli_connect_error());
exit();
}
mysqli_query($conn, "UPDATE dimgs SET views = views + 1 WHERE id = " . $_GET['id']);
$query = "SELECT * from dimgs WHERE id = '" . $_GET['id'] . "' and hidden=0";
$result = mysqli_query($conn, $query);
$dimg = mysqli_fetch_assoc($result);
$query = "SELECT * from imgs WHERE hash = '" . $_GET['id'] . "' order by id asc limit 1";
$result = mysqli_query($conn, $query);
$img = mysqli_fetch_assoc($result);
$query = "SELECT * from kws WHERE slug = '" . $img['slug'] . "'";
$result = mysqli_query($conn, $query);
$kw = mysqli_fetch_assoc($result);
$caption = fixcaption($img['caption']);
if($dimg['id'] == '') {
header("HTTP/1.0 404 Not Found");
include_once('404.php');
die();
}
$ads=1;
$title= $kw['kw']." Logo" ;
$page='logo';
include_once('header.php');
?>
Logo
if(isAdmin()){
echo ''.$dimg['views'].'
Copyright - Kws: ';
$query = "SELECT * from imgs WHERE hash = '" . $_GET['id'] . "'";
$result = mysqli_query($conn, $query);
while($aimg = mysqli_fetch_array($result)) {
$query = "SELECT * from kws WHERE slug = '" . $aimg['slug'] . "'";
$result = mysqli_query($conn, $query);
$akw = mysqli_fetch_assoc($result);
echo '
'.$akw['kw'].' ';
}
echo '
';
}?>
Logo ›
/* if(isAdmin()){ ?>
c } */?>
view if ($dimg['views']!=1){echo 's';}?>
echo filesize_formatted("/srv/www/logodix.com/public_html/logo/".$dimg['id'].'.'.$dimg['type']);
?>
x
Jan 1, 1970
License: not commercial use
function removeOutliers($arr, $alpha = 0.1, $beta = 1.9) {
$median = array_median($arr);
//$median = array_search($median, $arr);
// assuming the array is sorted after median calculation
$bound = $median * $alpha;
echo "lower bound: " . $bound;
$lower = 0;
while ($arr[$lower]['count'] < $bound)
$lower++;
$bound = $median * $beta;
echo "upper bound: " . $bound;
$upper = count($arr) - 1;
while ($arr[$upper]['count'] > $bound)
$upper--;
echo "lower: " . $lower . " --- upper: " . $upper;
return array_slice($arr, $lower, $upper - $lower + 1);
}
function array_median($array) {
$iCount = count($array);
if ($iCount == 0) {
throw new DomainException('Median of an empty array is undefined');
}
$middle_index = floor($iCount / 2);
$median = $array[$middle_index]['count']; // assume an odd # of items
// Handle the even case by averaging the middle 2 items
if ($iCount % 2 == 0) {
$median = ($median['count'] + $array[$middle_index - 1]['count']) / 2;
}
echo "median: " . $median;
return $median;
}
function aasort (&$array, $key) {
$sorter=array();
$ret=array();
reset($array);
foreach ($array as $ii => $va) {
$sorter[$ii]=$va[$key];
}
asort($sorter);
foreach ($sorter as $ii => $va) {
$ret[$ii]=$array[$ii];
}
$array=$ret;
}
require 'vendor/autoload.php';
use League\ColorExtractor\Color;
use League\ColorExtractor\ColorExtractor;
use League\ColorExtractor\Palette;
//$palette = Palette::fromFilename('/srv/www/logodix.com/public_html/logo/'.$dimg['id'].'.'.$dimg['type']);
$palette = Palette::fromGD(imagecreatefromstring(file_get_contents('/srv/www/logodix.com/public_html/logo/'.$dimg['id'].'.'.$dimg['type'])));
$extractor = new ColorExtractor($palette);
$colors = $extractor->extract(7);
$colorsArray = array()['color']['count'];
$i = 0;
foreach($colors as $color) {
$count = $palette->getColorCount($color);
$colorsArray[$i] = array();
$colorsArray[$i]['color'] = Color::fromIntToHex($color);
$colorsArray[$i]['count'] = $count;
$i++;
}
//var_dump($colorsArray);
aasort($colorsArray, "count");
$colorsArray = array_reverse($colorsArray);
foreach($colorsArray as $color) {
echo '
'.$color['color']."
\n";
}
?>
Similar Logos
$query = "SELECT * from imgs WHERE kw = " . $kw['id'] . " and hidden=0 and hash!='' order by rand()";
if(!$device->isMobile()) {
$query .= " limit 7";
} else {
$query .= " limit 6";
}
$results = mysqli_query($conn, $query);
$i=0;
while($img = mysqli_fetch_assoc($results)) {
$caption = str_replace (' - Wikipedia','', $img['caption']);
?>
/*
x
*/?>
/* if(isAdmin()){ ?>
c } */?>
} ?>
if($fsads) { ?>
} ?>
include('footer.php');?>