Example #1
0
$retCodeOK = true;
$cacheAllowed = 7200;
if (file_exists($cacheFile)) {
    $file_time = filemtime($cacheFile);
    $now = time();
    $diff = $now - $file_time;
    ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): ' . $cacheFile . "\n\tcache time   = " . date('c', $file_time) . " from unix time {$file_time}\n\tcurrent time = " . date('c', $now) . " from unix time {$now} \n\tdifference   = {$diff} (seconds)\n\tdiff allowed = {$cacheAllowed} (seconds) -->");
    if ($diff <= $cacheAllowed) {
        // is it still usable
        $im = $cacheFile;
        ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): image returned = ' . $im . ' -->');
        return;
    }
}
ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): loading fresh image -->');
$im = LoadPNG($retCodeOK, $yrTotalPng);
// load picture
if (!$retCodeOK) {
    // something went wrong, probably loading url
    ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): no good return code, up cache time 5* -->');
    if (file_exists($cacheFile) && $diff < 5 * $cacheAllowed) {
        // if it is not tooooooo old, try cache
        ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): cached image not to old -->');
        $im = $cacheFile;
        return;
    }
    ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): no good image load, returned url = ' . $im . ' -->', true);
    $im = $yrTotalPng;
    return;
}
// we correctly loaded a new picture
Example #2
0
<?php

function LoadPNG($imgname)
{
    /* Attempt to open */
    $im = @imagecreatefrompng($imgname);
    /* See if it failed */
    if (!$im) {
        $im = @imagecreatefrompng("/usr/local/share/pbi-manager/icons/default.png");
    }
    imageAlphaBlending($im, true);
    imageSaveAlpha($im, true);
    return $im;
}
header('Content-Type: image/png');
$ipath = $_GET['i'];
$img = LoadPNG("{$ipath}");
imagepng($img);
imagedestroy($img);
Example #3
0
             imagestring($frame, 1, 5, 5, 'Error loading ' . $imgname, $tc);
         }
         imagealphablending($frame, true);
         imagesavealpha($frame, true);
         $frame_overlay = @imagecreatefrompng($imgname);
         imagealphablending($frame_overlay, true);
         imagesavealpha($frame_overlay, true);
         $user_photo = imagecreatefromjpeg($GLOBALS["the_file"]);
         $profile_image = imagecreatetruecolor(1000, 1000);
         list($width, $height) = getimagesize($GLOBALS["the_file"]);
         imagecopyresized($profile_image, $user_photo, 0, 0, 0, 0, 1000, 1000, $width, $height);
         imagecopymerge($frame, $profile_image, 140, 150, 0, 0, 1000, 1000, 100);
         imagecopy($frame, $frame_overlay, 0, 0, 0, 0, 1200, 1200);
         return $frame;
     }
     $img = LoadPNG('img/' . $frameSelect . '.png');
     imagepng($img, 'img/user/' . $foto . '.png');
     imagedestroy($img);
     include "dbcrud.php";
     $db = new connect();
     $db->connect_it("yoletsgo");
     $db->setdata("INSERT INTO `user_table` (`id`, `name`, `partner_name`, `age`, `email_address`, `phone_number`, `address`, `city`, `country`, `favourite_sport`, `reason`, `pic_name`) VALUES (NULL, '{$name}', '{$partnerName}', '{$age}', '{$emailAddress}', '{$phoneNumber}', '{$address}', '{$city}', '{$country}', '{$favouriteSport}', '{$reason}', '{$foto}');");
 }
 switch ($step) {
     case 1:
         $pages = "register.php";
         break;
     case 2:
         $pages = "upload.php";
         break;
     case 3:
Example #4
0
    $imgFolder = 60;
} elseif ($imgPX <= 80) {
    $imgFolder = 80;
} elseif ($imgPX <= 100) {
    $imgFolder = 100;
} else {
    $imgFolder = 189;
}
//load the source image
//if (substr($imgName, 0, 1) === "c"){
if (isset($usrCustomImagesFolder)) {
    $imgName = substr($imgName, 1);
    //$usrCustomImagesFolder = rtrim(get_option("usrCustomImagesFolder"),"/");
    $imgTemp = LoadPNG('../../../' . $usrCustomImagesFolder . '/' . $imgFolder . '/' . $imgName);
} else {
    $imgTemp = LoadPNG('../images/' . $imgFolder . '/' . $imgName);
}
//set x and y for temp images
$imgWidth = imagesx($imgTemp) / 2;
$imgHeight = imagesy($imgTemp);
//create an output image with transparent background
$imgOutput = imagecreate($imgWidth * $imgCount, $imgHeight);
$black = imagecolorallocate($imgOutput, 0, 0, 0);
imagecolortransparent($imgOutput, $black);
//create two temp images (1 bright / 1 dark) with transparent background
$imgTempFore = imagecreate($imgWidth, $imgHeight);
$imgTempBack = imagecreate($imgWidth, $imgHeight);
$black = imagecolorallocate($imgTempFore, 0, 0, 0);
imagecolortransparent($imgTempFore, $black);
$black = imagecolorallocate($imgTempBack, 0, 0, 0);
imagecolortransparent($imgTempBack, $black);
Example #5
0
    $row2 = $q2->fetch_assoc();
    if ($row2['guild'] != null) {
        $row['guildname'] = $row2['guild'];
    }
}
$q2->free();
$image = imagecreatetruecolor(271, 162);
imagealphablending($image, false);
imagesavealpha($image, true);
$bg_image = imagecreatefrompng("../inc/img/char_bg.png");
imagecopyresampled($image, $bg_image, 0, 0, 0, 0, 271, 386, 271, 386);
imagealphablending($image, true);
// LOAD CHARACTER
$charpos_x = -4;
$charpos_y = 15;
$character_image = LoadPNG("http://" . $domain . "/avatar/" . $charname);
//$character_image = LoadPNG("http://mapler.me/avatar/".$charname);
imagecopyresampled($image, $character_image, $charpos_x, $charpos_y, 0, 0, 128, 128, 128, 128);
// SET NAMETAG
$name = $row['name'];
$x = $charpos_x + 128 / 2;
$y = $charpos_y + 15 + 96;
$startWidth = $x - calculateWidth($name) / 2;
$endWidth = $x + calculateWidth($name) / 2;
ImageTTFText($image, $font_size, 0, $startWidth + 3, $y - 5, imagecolorallocate($image, 255, 255, 255), $font, $name);
$base_x = 152;
$base_y = 55;
$step = 18;
ImageTTFText($image, 9, 0, $base_x, $base_y + $step * 0, imagecolorallocate($image, 0, 0, 0), $font, $row['level']);
ImageTTFText($image, 9, 0, $base_x, $base_y + $step * 1, imagecolorallocate($image, 0, 0, 0), $font, GetJobname($row['job']));
ImageTTFText($image, 9, 0, $base_x, $base_y + $step * 2, imagecolorallocate($image, 0, 0, 0), $font, $row['fame']);
Example #6
0
    }
    // eo check if function already defined/used
    $image = LoadJPEG($retCode, $outputImage);
    #      echo '>'.$retCode.'<';
    #     echo '>'.$image.'<';; exit;
    imagejpeg($image);
    imagedestroy($image);
    return;
}
if ($image_type == 'png') {
    if (!function_exists('LoadPNG')) {
        // this function is used in other scripts also - do not change
        function LoadPNG(&$retCode, $imgname)
        {
            $im = @imagecreatefrompng($imgname);
            // Attempt to open
            if (!$im) {
                $retCode = false;
            }
            // if it fails we do not know what to do with webcam images
            return $im;
        }
        // eof  LoadPNG
    }
    // eo check if function already defined/used
    $image = LoadPNG($retCode, $outputImage);
    imagepng($image);
    imagedestroy($image);
    return;
}
echo 'invalid image type';
    imagesavealpha($im, true);
    $transparent = imagecolorallocatealpha($im, 0, 0, 0, 127);
    imagefill($im, 0, 0, $transparent);
    return $im;
}
function LoadPNG($imgname)
{
    /* Attempt to open */
    $im = @imagecreatefrompng($imgname);
    /* See if it failed */
    if (!$im) {
        $im = imagecreatefrompng('./char.png');
    }
    return $im;
}
$img = LoadPNG('http://www.minecraft.net/skin/' . $player . '.png');
if ($usage == 'list') {
    $myhead = imagecreate(15, 15);
    $color = imagecolorallocate($myhead, 250, 250, 250);
    imagefill($myhead, 0, 0, $color);
    imagecopyresized($myhead, $img, 1, 1, 8, 8, 13, 13, 8, 8);
}
if ($usage == 'marker') {
    $myhead = CreateBlankPNG(21, 27);
    $mymarker = imagecreatefrompng('./marker_empty.png');
    imagecopy($myhead, $mymarker, 0, 0, 0, 0, 21, 27);
    imagecopyresized($myhead, $img, 1, 1, 8, 8, 19, 20, 8, 8);
}
if ($usage == 'info') {
    $myhead = CreateBlankPNG(48, 96);
    imagecopyresized($myhead, $img, 12, 0, 8, 8, 24, 24, 8, 8);
Example #8
0
    $freezePoint = 32;
} else {
    // use Centigrade settings
    $Tincr = 1;
    // increment number of degrees for major/minor ticks on thermometer
    $TMajTick = 5;
    // major tick with value when scale number divisible by this
    $freezePoint = 0;
}
# set thermometer range based on the in max values
$tMin = 5 * round(($min - 4) / 5);
$tMax = 5 * round(($max + 4) / 5);
$rangeT = $tMax - $tMin;
// total temperature range
$BlankGraphic = 'thermometer-blank.png';
$image = LoadPNG($BlankGraphic);
# settings relative to the thermometer image file defines the drawing area for the thermometer filling
# these settings are SPECIFICALLY for the thermometer-blank.png image background
$minX = 20;
// left
$maxX = 24;
// right
$minY = 20;
// top
$maxY = 140;
// bottom
$rangePx = $maxY - $minY;
$width = imagesx($image);
$height = imagesy($image);
$font = 1;
$tx = imagecolorallocate($image, 0, 0, 0);