Пример #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
if (isset($_GET['id'])) {
    $id = $_GET['id'];
}
if (isset($_GET['hue'])) {
    $hue = $_GET['hue'];
}
unset($_GET['id']);
unset($_GET['hue']);
/* $sql = mysql_query("SELECT * FROM dbsphere.items WHERE DEFNAME='$id'");
while($item = mysql_fetch_array($sql)) {
} */
if (!file_exists("images/art/gumpart_" . $id . "_" . $hue . ".png")) {
    creategumpart($id, $hue, 0);
    $imgurl = "images/gumpart/gumpart_" . $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/gumpart/gumpart_' . $id . '_' . $hue . '.png', 0, NULL);
    imagedestroy($img);
    imagedestroy($img2);
}
Header("Content-type: image/png");
Header("Content-disposition: inline; filename=gumpart_" . $id . "_" . $hue . ".png");
/* echo "<img src='images/gumpart/gumpart_$id_$hue.png'>";
return; */
$img = imagecreatefrompng("images/gumpart/gumpart_" . $id . "_" . $hue . ".png");
$black = imagecolorallocate($img, 0, 0, 0);
imagecolortransparent($img, $black);
imagepng($img);
imagedestroy($img);