示例#1
0
function fixart($id, $hue, $show)
{
    if (!file_exists("images/art/fixedart_" . $id . "_" . $hue . ".png")) {
        if (!file_exists("images/art/art_" . $id . "_" . $hue . ".png")) {
            include "art.php";
            createart($id, $hue, 0);
        }
        $imgurl = "images/art/art_" . $id . "_" . $hue . ".png";
        $img = imagecreatefrompng("{$imgurl}");
        $box = imageTrimBox($img);
        $img2 = imagecreatetruecolor($box['w'], $box['h']);
        imagecopy($img2, $img, 0, 0, $box['l'], $box['t'], $box['w'], $box['h']);
        imagepng($img2, 'images/art/fixedart_' . $id . '_' . $hue . '.png', 0, NULL);
        imagedestroy($img);
        imagedestroy($img2);
    }
    if ($show == 1) {
        Header("Content-type: image/png");
        Header("Content-disposition: inline; filename=art_" . $id . "_" . $hue . ".png");
        $img = imagecreatefrompng("images/art/fixedart_" . $id . "_" . $hue . ".png");
        $black = imagecolorallocate($img, 0, 0, 0);
        imagecolortransparent($img, $black);
        imagepng($img);
        imagedestroy($img);
        return;
    }
}
示例#2
0
function fixedart($id, $hue)
{
    //include("art.php");
    include "fiximg.php";
    if ($id[0] == 0) {
        $id = hexdec($id);
    }
    if ($hue[0] == 0) {
        $hue = hexdec($hue);
    }
    $file = "images/art/art_" . $id . "_" . $hue . ".png";
    if (!file_exists($file)) {
        createart($id, $hue, 0);
    }
    $file2 = "images/art/fixedart_" . $id . "_" . $hue . ".png";
    if (!file_exists($file2)) {
        fixart($id, $hue, 0);
    }
    echo "<img src=\"{$file2}\">";
}
示例#3
0
        $id = intval($id);
    }
    if (!isset($_GET["hue"])) {
        $hue = 0;
    } else {
        $hue = $_GET["hue"];
        if ($hue[0] == 0) {
            $hue = hexdec($hue);
        } else {
            $hue = intval($hue);
        }
    }
    if ($_SERVER['SCRIPT_NAME'] == '/art.php') {
        createart($id, $hue, 1);
    } else {
        createart($id, $hue, 0);
    }
    return;
}
function createart($id, $hue, $show)
{
    if (file_exists("images/art/art_" . $id . "_" . $hue . ".png")) {
        if ($show == 1) {
            Header("Content-type: image/png");
            Header("Content-disposition: inline; filename=art_" . $id . "_" . $hue . ".png");
            $img = imagecreatefrompng("images/art/art_" . $id . "_" . $hue . ".png");
            $black = imagecolorallocate($img, 0, 0, 0);
            imagecolortransparent($img, $black);
            imagepng($img);
            return;
        }