Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php/** manual for this function can be found in* directory: /module/classes/browser_class.php* written by markus niewerth** (c) 2002** mail: markus@niewerth.com** this function creates screens and copy some text or other Graphic* in the root image. you can use n fonttypes assigned from 1 to n* fonts can added @ this way: upload some ttf in dir /GD/TTF/* and add the type name in array($types).** function was written by markus niewerth (2002).* mail: markus@niewerth.com* system requirements: linux/unix w. gd-1.8.4 or higher** function use:* createScreen([int dst_img_big],[int dst_sm_logo],[int width],[int height],* [int imagename],[int fonttype],[int fontsize]);** fonttypes:* [1] => arial.ttf [2] => denmark.ttf [3] => dexgothn.ttf* [4] => dotmatrix.ttf [5] => erasure.ttf [6] => eq.ttf* [7] => xfiles.ttf [8] => fesf____.ttf*/function createScreen($screen,$logo,$newWidth,$newHeight,$ttftext,$ftype,$fsize, $fdir="", $ftypes=""){$IMpassed = true;if($newWidth>=4100 || $newHeight>=2000){return(false);exit();}if(empty($ftype))$ftype = 3;if(empty($fsize))$fsize = 13;if(!$fdir){$fdir = $_SERVER['DOCUMENT_ROOT']."content-management/Online-Shop/gutschein/TTF/"; /* ttf font directory */$ftypes = array (1 => "arial.ttf","denmark.ttf","dexgothn.ttf","dotmatrix.ttf","erasure.ttf","eq.ttf","xfiles.ttf","fesf____.ttf","AARVC___.ttf","cut_above_the_rest.ttf"); /* supported ttf fonts */}$types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp"); /* this is helpful for call_user_func */$font = $fdir.$ftypes[$ftype];$size = imageTTFBBox($fsize, 0, $font, $ttftext); /* all font parameter */$imgsz = @getimagesize("$screen");$imgszl = @getimagesize("$logo");if(!$imgsz)$IMpassed = false;// only the 3 first image array($types) are suppportedif($imgsz[2]<= 3 && $IMpassed == true):$imgh = @call_user_func("imagecreatefrom".$types[$imgsz[2]], $screen); /* here we call a userdefenied function */$imgh2 = @call_user_func("imagecreatefrom".$types[$imgszl[2]], $logo); /* here we call a userdefenied function */$imgCreate = imagecreate($newWidth, $newHeight); /* create the new image stream */$x = $newWidth-$imgszl[0]; /* place the copyright logo in x-coordination*/$y = $newHeight-$imgszl[1]; /* place the copyright logo in y-coordination*/$x=0;$y=0;$newname = rand(1,10000000000);/* noc cahce header */header("Pragma: no-cache");header("Expires: 0");header("Content-Disposition: filename=".$newname.".".$types[$imgsz[2]]."");header("Content-Description: PHP Generated Data");header("Content-type: image/".$types[$imgsz[2]]."");$white = imagecolorallocate($imgCreate, 0, 0, 0);if(imagecopyresized($imgCreate,$imgh, 0, 0, 0, 0, $newWidth, $newHeight, $imgsz[0], $imgsz[1])):imagecopy($imgCreate,$imgh2, $x, $y, 0, 0, $imgszl[0], $imgszl[1]);$counter=1;if(is_array($ttftext)){foreach(array_keys($ttftext) AS $elem){// echo $ttftext[$elem];imageTTFText($imgCreate, $fsize, 0, 20, 100+(($fsize)*$counter+1), $white, $font, $ttftext[$elem]);$counter++;}}elseimageTTFText($imgCreate, $fsize, 0, 20, 120, $white, $font, $ttftext);return(call_user_func("image".$types[$imgsz[2]], $imgCreate,'',100)); /*here we call a userdefenied function */ImageDestroy($imgCreate);else:$newname = split("[/]", $screen);header("Content-Type: application/octet-stream");header("Pragma: no-cache");header("Expires: 0");header("Content-Disposition: filename=error.html");header("Content-Description: PHP Generated Data");header("Content-type: text/html");endif;elseif($imgsz[2] >= 4):$newname = split("[/]", $screen);header("Content-Type: application/octet-stream");header("Pragma: no-cache");header("Expires: 0");header("Content-Disposition: filename=error");header("Content-Description: PHP Generated Data");header("Content-type: image/jpg");endif;if($IMpassed == false):print ("Achtung Fehlerhafte Bild Koordinaten. Das Bild kann nicht gelesen werden.");# header("Content-Type: application/octet-stream");header("Pragma: no-cache");header("Expires: 0");header("Content-Disposition: filename=error.log");header("Content-Description: PHP Generated Data");header("Content-type: text/plain");endif;}/** function end* here you can place some other misc.* like me. Or include this function.*/if(empty($cr)){$cr = "";}$settings = parse_ini_file("settings.ini.php", TRUE);$siteurl = $settings['directorys']['siteurl'];$url = $settings['directorys']['webpath'].$scr;$crimage = $settings['directorys']['webpath'].$settings['directorys']['crimage'];// print_r($settings);createScreen($url,$crimage,$wd,$hg,$cr,$ft,$fs, $settings['directorys']['fdir'], $settings['ftypes']);?>