| Neuer Benutzer
Registriert seit: 31.10.2009
Beiträge: 6
PHP-Kenntnisse: Anfänger
| Entschuldige bitte, mein Fehler.
Also als Forum nutze ich VBulletin3.7.4.
Die GD-Library 2 ist installiert und in der PHP.ini aktiviert.
Der Code der Smiley.php PHP-Code: <?
ob_start(); require("stat.php"); ob_end_clean(); Header("Content-type: image/gif");
ini_set('magic_quotes_gpc', OFF); ini_set('magic_quotes_sybase', OFF);
$path = getCWD();
if(isset($_REQUEST['smiley']) && ($_REQUEST['smiley'])!==''){ $smiley = ($_REQUEST['smiley']); } else { $smiley = 'bleh'; }
if(isset($_REQUEST['fontcolor']) && ($_REQUEST['fontcolor']) !==''){ $schriftfarbe = ($_REQUEST['fontcolor']); $schriftfarbe = str_replace("#", "", $schriftfarbe);
} else { $schriftfarbe = '000000'; }
if(isset($_REQUEST['ss']) && ($_REQUEST['ss']) =='0'){ $schildschatten = 'false'; } else { $schildschatten = 'true'; }
if(isset($_REQUEST['font']) && ($_REQUEST['font']) !==''){ $schriftdatei = ($_REQUEST['font']); } else { #$schriftdatei = 'comicbook.ttf'; $schriftdatei = ''; }
if(isset($_REQUEST['signcolor']) && ($_REQUEST['signcolor']) !==''){ $schcolor = ($_REQUEST['signcolor']); $schcolor = str_replace("#", "", $schcolor); } else { $schcolor = 'FFFFFF'; }
$defaulttext = "Hello!";
if (isset($_REQUEST['text']) && ($_REQUEST['text'])!==''){ $text = stripslashes($_REQUEST['text']); } else { $text = "$defaulttext"; }
if (isset($_REQUEST['shadowcolor']) && ($_REQUEST['shadowcolor'])!==''){ $schattenfarbe = ($_REQUEST['shadowcolor']); $schattenfarbe = str_replace("#", "", $schattenfarbe); } else { $schattenfarbe = ''; }
include("$path/config.php");
$base = base64_encode("$text$smiley$schriftfarbe$schildschatten$schriftdatei$schattenfarbe$schcolor"); $base = str_replace("=", "", $base); $base = str_replace(" ", "", $base);
$file = "temp/".$base."-final.gif";
if(file_exists($file)){ $file = readfile($file); echo $file; } else {
$text = stripslashes($text);
if($phpversion_nr >= 4.30) $gd_info = gd_info(); else{ $gd_info["FreeType Support"] = 1; }
if((!$gd_info["FreeType Support"]) || (!file_exists($schriftdatei))){ $schriftwidth = 6; $schriftheight = 8; }else{ if((!$schriftheight) || (!$schriftwidth)){ $schriftwidth = imagefontwidth($schriftdatei); $schriftheight = imagefontheight($schriftdatei); } } $schriftheight += 3;
/*while(substr_count($text, "<")){ $text = ereg_replace(substr($text, strpos($text, "<"), (strpos($text, ">") - strpos($text, "<") + 1)), "", $text); }*/
if(!$text) $text = $defaulttext;
if(strlen($text) > 33){ $worte = split(" ", $text);
if(is_array($worte)){ $i = 0; foreach($worte as $wort){ if((strlen($output[$i]." ".$wort) < 33) && (!substr_count($wort, "[SM"))){ $output[$i] .= " ".$wort; }else{ if($i <= 11){ if($zeichenzahl < strlen($output[$i])) $zeichenzahl = strlen($output[$i]); $i++; $output[$i] = $wort; } } } }else{ $zeichenzahl = 33; $output[0] = substr($text, 0, 30)."..."; } }else{ $zeichenzahl = strlen($text); $output[0] = $text; }
if(count($output) > 12) $output[12] = substr($output[12], 0, 30)."...";
$width = ($zeichenzahl * $schriftwidth) + 20; $height = (count($output) * $schriftheight) + 34; if($width < 60) $width = 60;
#$smiley = imagecreatefrompng("modules/Forums/images/smiles/schild/smiley".$smiley.".png");
if($smiley =='mad'){ $schild = imagecreatefrompng("sign/sign2.png"); } else { $schild = imagecreatefrompng("sign/sign.png"); }
$trans2 = imagecolorallocate ($schild, 111, 252, 134); imagefill($schild, 0, 0, $trans2); imagecolortransparent($schild, $trans2); // Dummybg als transparenz setzen imageinterlace( $schild, 1 );
$img = imagecreate($width,$height);
$bgcolor = imagecolorallocate ($img, 111, 252, 134); $txtcolor = imagecolorallocate ($img, hexdec(substr(str_replace("#","",$schriftfarbe),0,2)), hexdec(substr(str_replace("#","",$schriftfarbe),2,2)), hexdec(substr(str_replace("#","",$schriftfarbe),4,2))); $txt2color = imagecolorallocate ($img, hexdec(substr(str_replace("#","",$schattenfarbe),0,2)), hexdec(substr(str_replace("#","",$schattenfarbe),2,2)), hexdec(substr(str_replace("#","",$schattenfarbe),4,2))); $bocolor = imagecolorallocate ($img, 0, 0, 0);
if($schildschatten == 'true'){ $schcolor = imagecolorallocate ($img, 255, 255, 255); } else { if(isset($_REQUEST['signcolor']) && ($_REQUEST['signcolor']) !==''){ $schcolor = ($_REQUEST['signcolor']); $schcolor = imagecolorallocate ($img, hexdec(substr($schcolor ,0,2)), hexdec(substr($schcolor,2,2)), hexdec(substr($schcolor,4,2))); } else { $schcolor = imagecolorallocate ($img, 255, 255, 255); } }
$schatten1color = imagecolorallocate ($img, 235, 235, 235); $schatten2color = imagecolorallocate ($img, 219, 219, 219);
if($smiley =='doh'){ $h = "29"; } else { $h = "24"; } imagecopy ($img, $schild, ($width / 2 - 3), 0, 0, 0, 6, 4); // Bildteil kopieren imagecopy ($img, $schild, ($width / 2 - 3), ($height - 24), 0, 5, 9, 17); // Bildteil kopieren #imagecopy ($img, $smiley, ($width / 2 + 6), ($height - 24), 0, 0, 23, 23); // Bildteil kopieren
imagefilledrectangle($img, 0, 4, $width, ($height - 25), $bocolor); imagefilledrectangle($img, 1, 5, ($width - 2), ($height - 26), $schcolor);
if($schildschatten == 'true'){ imagefilledpolygon($img, array((($width - 2) / 2 + ((($width - 2) / 4) - 3)), 5, (($width - 2) / 2 + ((($width - 2) / 4) + 3)), 5, (($width - 2) / 2 - ((($width - 2) / 4) - 3)), ($height - 26), (($width - 2) / 2 - ((($width - 2) / 4) + 3)), ($height - 26)), 4, $schatten1color); imagefilledpolygon($img, array((($width - 2) / 2 + ((($width - 2) / 4) + 4)), 5, ($width - 2), 5, ($width - 2), ($height - 26), (($width - 2) / 2 - ((($width - 2) / 4) - 4)), ($height - 26)), 4, $schatten2color); }
$i = 0; while($i < count($output)){ if(((!$gd_info["FreeType Support"]) || (!file_exists($schriftdatei)))){ if($schattenfarbe <>''){ imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + 6), trim($output[$i]), $txt2color); } imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2), ($i * $schriftheight + 5), trim($output[$i]), $txtcolor); }else{ if($schattenfarbe <>''){ imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 2) / 2 + 1), ($i * $schriftheight + $schriftheight + 4), $txt2color, $schriftdatei, trim($output[$i])); } imagettftext($img, $schriftheight, 0, (($width - (strlen(trim($output[$i])) * $schriftwidth) - 5) / 2), ($i * $schriftheight + $schriftheight + 3), $txtcolor, $schriftdatei, trim($output[$i])); } $i++; }
imagecolortransparent($img, $bgcolor); // Dummybg als transparenz setzen imageinterlace($img, 1);
foreach (glob("$smiley/*.res") as $filename) {
$smiley2 = imagecreatefromgif("$filename"); $canvas = imagecreate($width, $height); $trans = imagecolorallocate ($canvas, 111, 252, 134); imagecolortransparent($canvas, $trans); // Dummybg als transparenz setzen imageinterlace( $canvas, 1 ); imagecopymerge($canvas, $img, 0, 0, 0, 0, $width, $height, 100); imagecopymerge ($canvas, $smiley2, ($width / 2 + 3), ($height - $h), 0, 0, $x, $y, 100); // Bildteil kopieren
$frame = str_replace("$smiley/", "", $filename); $frame = str_replace(".res", "", $frame);
Imagegif($canvas, "temp/$base.$frame.gif", 100); ImageDestroy($smiley2); ImageDestroy($canvas);
} ImageDestroy($img); ImageDestroy($schild);
require("$smiley/cmd.php");
exec("$cmd 2>&1", $output); foreach($output as $outputline){ }
$file2 = readfile("temp/".$base."-final.gif"); echo $file2; } ?>
Geändert von swsche (31.10.2009 um 12:32 Uhr).
|