//exit; } //imagepng($im); //imagedestroy($im); header("Content-Type: image/png"); $im = imagecreatefrompng($bg_gray); if (empty($_GET['alpha'])) { $_GET['alpha'] = 10; } $color = imagecolorallocatealpha($im, $red, $green, $blue, $_GET['alpha']); if ($value2 < 0) { imagefillalpha($im, $color, $w); } else { imagefillalpha($im, $color, $w, 1); $color2 = imagecolorallocatealpha($im, $red2, $green2, $blue2, $_GET['alpha']); imagefillalpha($im, $color2, $w2, 2); } $font = imageloadfont("proggyclean.gdf"); if ($value2 < 0) { $fontcolor = $value > 5 ? $white : $black; $xx = $value > 9 ? 10 : 3; imagestring($im, $font, $width / 2 - $xx, 2, $value, $fontcolor); //imagestring($im, $font, 10, 2, $value."/".$max, $fontcolor); } else { $txt = $value . "->" . $value2; $fontcolor = $black; $xx = $value > 9 ? 20 : 15; imagestring($im, $font, $width / 2 - $xx, 2, $txt, $fontcolor); } imagepng($im); imagedestroy($im);
imagettftext($im, 12, 0, 28, 18, $black, $font, $playername); imagettftext($im, 12, 0, 30, 20, $text_colour2, $font, $playername); imagettftext($im, 12, 0, 328, 18, $black, $font, $myservername); imagettftext($im, 12, 0, 330, 20, $text_colour2, $font, $myservername); imagettftext($im, 12, 0, 328, 40, $black, $font, $site); imagettftext($im, 12, 0, 330, 42, $text_colour2, $font, $site); imagettftext($im, 12, 0, 32, 62, $black, $font, 'Townhall: ' . $th); imagettftext($im, 12, 0, 30, 60, $adminrenk, $font, 'Townhall: ' . $th); imagettftext($im, 12, 0, 32, 82, $black, $font, 'Experience: ' . $exp); imagettftext($im, 12, 0, 30, 80, $adminrenk, $font, 'Experience: ' . $exp); imagettftext($im, 12, 0, 32, 100, $black, $font, 'Level: ' . $ava_level); imagettftext($im, 12, 0, 30, 98, $adminrenk, $font, 'Level: ' . $ava_level); imagettftext($im, 12, 0, 32, 120, $black, $font, 'Trophies: ' . $sc); imagettftext($im, 12, 0, 30, 118, $adminrenk, $font, 'Trophies: ' . $sc); imagettftext($im, 12, 0, 32, 140, $black, $font, 'Gems: ' . $gems); imagettftext($im, 12, 0, 30, 138, $adminrenk, $font, 'Gems: ' . $gems); //imagefilledrectangle($im, 478, 70, 636, 100, $wizardblue); imagettftext($im, 12, 0, 385, 72, $white, $font, 'Privileges: ' . $player["AccountPrivileges"]); imagettftext($im, 12, 0, 382, 73, $wizardblue, $font, 'Privileges: ' . $player["AccountPrivileges"]); imagettftext($im, 12, 0, 355, 92, $white, $font, 'Account Status: ' . $player["AccountStatus"]); imagettftext($im, 12, 0, 352, 93, $wizardblue, $font, 'Account Status: ' . $player["AccountStatus"]); imagesetthickness($im, 5); imageline($im, 30, 147, 642, 147, $black); imageline($im, 30, 145, 640, 145, $line_colour); imagefillalpha($im, $color); imagepng($im); imagedestroy($im); function ImageFillAlpha($image, $color) { imagefilledrectangle($image, 0, 0, imagesx($image), imagesy($image), $color); }
function resize($original, $w, $h, $crop, $cropratio = 0, $wm = 0, $catid = '') { require dirname(__FILE__) . DS . 'config.datsogallery.php'; jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $cro = str_replace(':', 'x', $cropratio); $dirname = "datsogallery_catid-{$catid}_{$w}x{$h}_{$cro}"; $types = array(1 => 'gif', 'jpeg', 'png'); if (!JFolder::exists(JPATH_SITE . DS . 'cache' . DS . $dirname)) { JFolder::create(JPATH_SITE . DS . 'cache' . DS . $dirname); $content = '<html><body bgcolor="#ffffff"></body></html>'; JFile::write(JPATH_SITE . DS . 'cache' . DS . $dirname . DS . 'index.html', $content); } if (!JFile::exists(JPATH_SITE . $ad_pathoriginals . DS . 'blank.jpg')) { JFile::copy(JPATH_COMPONENT_SITE . DS . 'images' . DS . 'blank.jpg', JPATH_SITE . $ad_pathoriginals . DS . 'blank.jpg'); } $path = JPath::clean(JPATH_SITE . $ad_pathoriginals . DS . $original); dgFileCheck($path); if (!file_exists($path) || is_dir($path) || !($size = getimagesize($path))) { return; } $width = $size[0]; $height = $size[1]; $mw = $w; $mh = $h; $x = 0; $y = 0; if ($crop == '1') { $cr = explode(':', $cropratio); if (count($cr) == 2) { $rc = $width / $height; $crc = (double) $cr[0] / (double) $cr[1]; if ($rc < $crc) { $oh = $height; $height = $width / $crc; $y = ($oh - $height) / 2; } else { if ($rc > $crc) { $ow = $width; $width = $height * $crc; $x = ($ow - $width) / 2; } } } } $xr = $mw / $width; $yr = $mh / $height; if ($xr * $height < $mh) { $th = ceil($xr * $height); $tw = $mw; } else { $tw = ceil($yr * $width); $th = $mh; } $relfile = JURI::root(true) . '/cache/' . $dirname . '/' . basename($original); $cachefile = JPATH_SITE . DS . 'cache' . DS . $dirname . DS . basename($original); if (file_exists($cachefile)) { $cachesize = getimagesize($cachefile); $cached = $cachesize[0] == $tw && $cachesize[1] == $th; if (filemtime($cachefile) < filemtime($path)) { $cached = false; } } else { $cached = false; } if (!$cached && ($size[0] >= $w || $size[1] >= $h)) { $resize = $size[0] >= $w || $size[1] >= $h; } elseif (!$cached && ($size[0] <= $w || $size[1] <= $h)) { $resize = true; } else { $resize = false; } if ($resize) { @increasememory($original); $image = call_user_func('imagecreatefrom' . $types[$size[2]], $path); $temp = $size[0] <= $w || $size[1] <= $h ? imagecreatetruecolor($width, $height) : imagecreatetruecolor($tw, $th); if (function_exists('imagecreatetruecolor') && $temp) { if (in_array($types[$size[2]], array('gif', 'png'))) { $color = 'F5F5F5'; $background = imagecolorallocate($temp, hexdec($color[0] . $color[1]), hexdec($color[2] . $color[3]), hexdec($color[4] . $color[5])); imagefillalpha($temp, $background); } if ($resize && ($size[0] <= $w || $size[1] <= $h)) { if (in_array($types[$size[2]], array('gif', 'png'))) { imagecopyresampled($temp, $image, 0, 0, 0, 0, $size[0], $size[1], $width, $height); } else { fastimagecopyresampled($temp, $image, 0, 0, 0, 0, $size[0], $size[1], $width, $height); } } else { if (in_array($types[$size[2]], array('gif', 'png'))) { imagecopyresampled($temp, $image, 0, 0, $x, $y, $tw, $th, $width, $height); } else { fastimagecopyresampled($temp, $image, 0, 0, $x, $y, $tw, $th, $width, $height); } } imagedestroy($image); $sharpness = findsharp($width, $tw); $sharpenMatrix = array(array(-1, -2, -1), array(-2, $sharpness + 12, -2), array(-1, -2, -1)); $divisor = $sharpness; $offset = 0; imageconvolution($temp, $sharpenMatrix, $divisor, $offset); if ($wm) { $watermarkPNGFile = JPATH_SITE . DS . 'components' . DS . 'com_datsogallery' . DS . 'images' . DS . 'watermark.png'; $watermarkMargin = 5; $watermark = imagecreatefrompng($watermarkPNGFile); $watermarkWidth = imagesx($watermark); $watermarkHeight = imagesy($watermark); $imageWidth = imagesx($temp); $imageHeight = imagesy($temp); switch ($ad_wmpos) { case 'topleft': $placeWatermarkX = $watermarkMargin; $placeWatermarkY = $watermarkMargin; break; case 'topright': $placeWatermarkX = $imageWidth - $watermarkWidth - $watermarkMargin; $placeWatermarkY = $watermarkMargin; break; case 'bottomleft': $placeWatermarkX = $watermarkMargin; $placeWatermarkY = $imageHeight - $watermarkHeight - $watermarkMargin; break; case 'bottomright': $placeWatermarkX = $imageWidth - $watermarkWidth - $watermarkMargin; $placeWatermarkY = $imageHeight - $watermarkHeight - $watermarkMargin; break; case 'center': $placeWatermarkX = ($imageWidth - $watermarkWidth) / 2 - $watermarkMargin; $placeWatermarkY = ($imageHeight - $watermarkHeight) / 2 - $watermarkMargin; break; } imagecopymerge_alpha($temp, $watermark, $placeWatermarkX, $placeWatermarkY, 0, 0, $watermarkWidth, $watermarkHeight, 0); } } if ($types[$size[2]] == 'jpeg') { dgChmod(JPATH_SITE . DS . 'cache' . DS . $dirname, 0777); call_user_func('image' . $types[$size[2]], $temp, $cachefile, $ad_thumbquality); dgChmod(JPATH_SITE . DS . 'cache' . DS . $dirname); } else { dgChmod(JPATH_SITE . DS . 'cache' . DS . $dirname, 0777); call_user_func('image' . $types[$size[2]], $temp, $cachefile); dgChmod(JPATH_SITE . DS . 'cache' . DS . $dirname); } imagedestroy($temp); } return $relfile; exit; }