function createthumb($folder, $prefix, $file, $maxsize) { global $gdlibchecked; if (!file_exists($folder . '/thumbnails/' . $prefix . '_' . $file)) { if (!$gdlibchecked) { $gdlibchecked = checkgdlib(); } if (preg_match('/(\\.jpg|\\.jpeg)$/i', $file)) { $image = imagecreatefromjpeg($folder . '/' . $file); } if (preg_match('/\\.png$/i', $file)) { $image = imagecreatefrompng($folder . '/' . $file); } list($width, $height) = getimagesize($folder . '/' . $file); $x_offset = $width > $height ? ($width - $height) / 2 : 0; $y_offset = $width < $height ? ($height - $width) / 2 : 0; $width = min($width, $height); $tn = imagecreatetruecolor($maxsize, $maxsize) or die('Cannot Initialize new GD image stream'); imagecopyresampled($tn, $image, 0, 0, $x_offset, $y_offset, $maxsize, $maxsize, $width, $width); if (!is_dir($folder . '/thumbnails')) { mkdir($folder . '/thumbnails', 0775); } // draw border for google map markers if ($prefix == 'gm') { $color_white = ImageColorAllocate($tn, 255, 255, 255); drawBorder($tn, $color_white, 2); } imagejpeg($tn, $folder . '/thumbnails/' . $prefix . '_' . $file, 90); } }
imagepng($image_new); imagedestroy($image_new); } else { $image = imagecreatefrompng("images/maps/charoff.png"); imagepng($image); imagedestroy($image); } } else { $image = imagecreatefrompng("images/maps/badchar.png"); imagepng($image); imagedestroy($image); } } if ($_REQUEST['type'] == 'house') { $x = $_GET['x']; $y = $_GET['y']; $z = $_GET['z']; $image = imagecreatefrompng("images/maps/" . $z . ".png"); list($width, $height) = getimagesize("images/maps/" . $z . ".png"); $new_width = 200; $new_height = 200; $color_white = ImageColorAllocate($image, 255, 255, 255); $color_black = ImageColorAllocate($image, 0, 0, 0); ImageFilledRectangle($image, $x - 30, $y - 25, $x - 28, $y - 23, $color_black); ImageArc($image, $x - 29, $y - 24, 5, 5, 0, 0, $color_white); $image_new = imagecreatetruecolor($new_width, $new_height); imagecopyresized($image_new, $image, 0, 0, $x - 60, $y - 60, $new_width, $new_height, 70, 70); drawBorder($image_new, $color_black, 3); imagepng($image_new); imagedestroy($image_new); }
$y1 = 0; $x2 = ImageSX($img) - 1; $y2 = ImageSY($img) - 1; for ($i = 0; $i < $thickness; $i++) { ImageRectangle($img, $x1++, $y1++, $x2--, $y2--, $color); } } header('Content-Type: image/png'); include "klassen.php"; $startx = 100 + $abschnitt % 5 * 20; $starty = 100 + floor($abschnitt / 5) * 20; $img = imagecreatetruecolor(20 * 34, 20 * 34); for ($i = $startx; $i < $startx + 20; $i++) { for ($j = $starty; $j < $starty + 20; $j++) { $f = new Weltraum($i, $j, 0, false); $split = explode(".", $f->bild); if (strtolower($split[sizeof($split) - 1]) == "png") { $piece = imagecreatefrompng("images/" . $f->bild); } if (strtolower($split[sizeof($split) - 1]) == "jpg") { $piece = imagecreatefromjpeg("images/" . $f->bild); } // Draw border $farbe = ImageColorAllocate($piece, 160, 0, 0); drawBorder($piece, $farbe); //var_dump($piece); imagecopy($img, $piece, $i * 34 - $startx * 34, $j * 34 - $starty * 34, 0, 0, 34, 34); } } imagepng($img); imagedestroy($img);