Exemple #1
0
function mklogoPic($WebID = "")
{
    $Class = getWebInfo($WebID);
    $WebName = $Class['WebName'];
    $WebTitle = $Class['WebTitle'];
    if (function_exists('mb_strwidth')) {
        $n = mb_strwidth($WebName) / 2;
    } else {
        $n = strlen($WebName) / 3;
    }
    //$width=50*$n+35;
    $size = round(350 / $n, 0);
    if ($size > 70) {
        $size = 70;
        $x = $size + 10;
        $size2 = 20;
    } else {
        $x = round(350 / $n, 0) + 10;
        $size2 = 17;
    }
    $y = $size + 55;
    header('Content-type: image/png');
    $im = @imagecreatetruecolor(520, 140) or die(_MD_TCW_MKPIC_ERROR);
    imagesavealpha($im, true);
    $white = imagecolorallocate($im, 255, 255, 255);
    //$trans_colour = imagecolorallocatealpha($im, 157,211,223, 127);
    $trans_colour = imagecolorallocatealpha($im, 255, 255, 255, 127);
    imagefill($im, 0, 0, $trans_colour);
    $text_color = imagecolorallocate($im, 0, 0, 0);
    $text_color2 = imagecolorallocatealpha($im, 255, 255, 255, 50);
    $gd = gd_info();
    if ($gd['JIS-mapped Japanese Font Support']) {
        $WebTitle = iconv("UTF-8", "shift_jis", $WebTitle);
        $WebName = iconv("UTF-8", "shift_jis", $WebName);
    }
    /*
        $insert = @imagecreatefrompng("images/shadow.png");
        imagecolortransparent($insert,imagecolorat($insert,0,0));
        $insert_x = imagesx($insert);
        $insert_y = imagesy($insert);
        imagecopymerge($im,$insert,0,0,0,0,$insert_x,$insert_y,100);
    */
    imagettftext($im, $size, 0, 0, $x, $text_color, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebName);
    imagettftextoutline($im, $size, 0, 0, $x, $text_color, $white, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebName, 2);
    imagettftext($im, $size2, 0, 0, $y, $text_color, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebTitle);
    imagettftextoutline($im, $size2, 0, 0, $y, $text_color, $white, XOOPS_ROOT_PATH . "/modules/tad_web/class/font.ttf", $WebTitle, 1);
    mk_dir(XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}");
    mk_dir(XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/auto_logo");
    imagepng($im, XOOPS_ROOT_PATH . "/uploads/tad_web/{$WebID}/auto_logo/auto_logo.png");
    imagedestroy($im);
}
        foreach ($events as $event) {
            //if ($eventWLT != "(0-0-0)") {
            //	$highestmatch = getHighestMatch($eventid, "string", $teamnumber);
            //	$eventranking = "";
            //	if ($highestmatch != "Participants" AND $highestmatch != "") {
            //		$eventranking = " - $highestmatch";
            //	}
            //	// TTF processing is not doing "silkscreen" N and M correctly in GD 2.0.28. Fixed in 2.0.35. Waiting for PHP to incorporate updated library.
            //	imagettftextoutline($teamoverlay,6,0,18,$event_text_offset,$negwhite,$negblack,'slkscr.ttf',"$eventshort:",1);
            //imagettftextoutline($teamoverlay,6,0,90,$event_text_offset,$negwhite,$negblack,'slkscr.ttf',"{$eventWLT}{$eventranking}",1);
            //} else {
            //event happens in future, or team didn't really play at event
            imagettftextoutline($teamoverlay, 6, 0, 18, $event_text_offset, $negwhite, $negblack, 'slkscr.ttf', "{$event["short_name"]}:", 1);
            $start_date = strtotime($event["start_date"]);
            $pretty_start_date = date("F j, Y", $start_date);
            imagettftextoutline($teamoverlay, 6, 0, 90, $event_text_offset, $negwhite, $negblack, 'slkscr.ttf', $pretty_start_date, 1);
            //}
            $event_text_offset = $event_text_offset + 10;
            //+12 for imageStringOutline, 10 for TTF
        }
    }
    //imageStringoutline($teamoverlay,3,295,53,$white,$black,"$year Record: $yearWLT",1);
    //save it
    imagePNG($teamoverlay, "teamoverlays/team" . $teamnumber . ".png");
    //kill it
    imageDestroy($teamoverlay);
}
// Step 1. Create a new blank image
$im = imageCreateTrueColor(470, 70);
imageAlphaBlending($im, TRUE);
//Get the whole background layer in, copy it, and destroy it.
Exemple #3
0
$bottombox = imagettfbbox($sizebottom, 0, $font, $bottom);
$bottomwidth = $bottombox[0] + $bottombox[2];
$bottomx = ($card_width - $bottomwidth) / 2;
$topline = $template['topline'];
#55;
$bottomline = $template['bottomline'];
#245;
$outline = 2;
if (isset($template['invert'])) {
    $y = $black;
    $black = $white;
    $white = $y;
    $outline = 0;
}
imagettftextoutline($image, $sizetop, 0, $topx, $topline, $white, $black, $font, $top, $outline);
imagettftextoutline($image, $sizebottom, 0, $bottomx, $bottomline, $white, $black, $font, $bottom, $outline);
#
#imagettftext($image, $size, 0, $topx,      $baseline, $white, $font, $top);
#imagettftext($image, $size, 0, $bottomx, 255, $white, $font, $bottom);
// Reflector time:
if (headers_sent()) {
    echo "<hr />Not sending image, headers already sent.";
} else {
    header("Content-Type: image/jpeg");
    if (isset($_GET['comp'])) {
        $comp = $_GET['comp'];
    } else {
        $comp = 60;
    }
    imagejpeg($image, null, $comp);
    //header("Content-Type: image/png");