PHP als Image.. Lukt niet bij 4 op 1 pagina

Status
Niet open voor verdere reacties.

Maximvdw

Gebruiker
Lid geworden
7 feb 2009
Berichten
921
Hallo,
Ik heb een userbar met PHP gemaakt. Ik ben een noob in PHP en ik snap echt niet wat ik moet doen.. Alles lukt perfect als er 2-3 mensen de userbar op 1 pagina gebruiken. Maar als je meer hebt , dan lukt het niet
http://www.helpmij.nl/forum/showthread.php/650637-De-HelpMij.nl-Userbars/page5
Soms lukt het wel, maar meestal niet
Hier zie je (als je wat naar beneden scrolt dat sommige een Image fout hebben zoals:

Hoe zou het komen dat dit gebeurt? Ligt het aan de server of aan het scriptje?
Het zou dit moeten zijn :
UB_Weer.php


gr,
Maxim
 
Laatst bewerkt:
..bump.. Weet iemand wat het probleem zou kunnen zijn :(

PHP code:

PHP:
<?php

// -----------------------------
// Made by Maxim Van de Wynckel
// Copyright 2011
// Made for www.HelpMij.nl
// -----------------------------

// This PHP script will get the local weather from google Weather and will write
// it on the selected userbar. with .php?city=Brussel&style=rainbow_yellow

// Set PHP as PNG file so It can be used in forums
	header('Content-type: image/png');

// Get Arguments
$city = $_GET['city'];
$style = $_GET['style'];

$BaseURL = "http://www.google.com/ig/api?weather=";
$FullURL = $BaseURL.$city;
$xml = simplexml_load_file($FullURL);
$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
$text = $information[0]->postal_code['data']." : ".$current[0]->temp_c['data']." °C";

// Kies de achtergrond
if($style == "classic"){
	// Classic Style selected
	$im = imagecreatefrompng("UB_Classic.png");
	$colorB = imagecolorallocate($im, 0, 0, 0);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 28;
	} 
elseif($text == "classicdark"){
	// Classic Dark Style selected
	$im = imagecreatefrompng("UB_ClassicDark.png");
	$colorB = imagecolorallocate($im, 5, 46, 86);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 16;
	} 
elseif($style == "emboss"){
	// Emboss Style selected
	$im = imagecreatefrompng("UB_Emboss.png");
	$colorB = imagecolorallocate($im, 0, 0, 0);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 28;
	} 
elseif($style == "rainbow_blue"){
	// Rainbow Blue Style selected
	$im = imagecreatefrompng("UB_RainbowBlue.png");
	$colorB = imagecolorallocate($im, 37, 39, 125);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 14;
	} 
elseif($style == "rainbow_green"){
	// Rainbow Green Style selected
	$im = imagecreatefrompng("UB_RainbowGreen.png");
	$colorB = imagecolorallocate($im, 62, 136, 15);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 14;
	} 
elseif($style == "rainbow_red"){
	// Rainbow Red Style selected
	$im = imagecreatefrompng("UB_RainbowRed.png");
	$colorB = imagecolorallocate($im, 176, 25, 20);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 14;
	} 
elseif($style == "rainbow_yellow"){
	// Rainbow Yellow Style selected
	$im = imagecreatefrompng("UB_RainbowYellow.png");
	$colorB = imagecolorallocate($im, 114, 113, 28);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 14;
	} 
else {
	// Default Style selected
	$im = imagecreatefrompng("UB_ClassicDark.png");
	$colorB = imagecolorallocate($im, 5, 46, 86);
	$color = imagecolorallocate($im, 255, 255, 255);
	$xAllign = 16;
	}


// Font settings
	$font = 'visitor.ttf';
	$fontsize = 8;
	$size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string

// Create the Border of the text
	$x = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text
	$y = 12;
		imagettftext($im, $fontsize, 0, $x-1, $y-1, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x-1, $y, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x-1, $y+1, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x, $y+1, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x, $y-1, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x+1, $y-1, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x+1, $y, $colorB, $font, $text);
		imagettftext($im, $fontsize, 0, $x+1, $y+1, $colorB, $font, $text);
// Write text
		imagettftext($im, $fontsize, 0, $x, $y, $color, $font, $text);

imagepng($im);
imagedestroy($im);
?>
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan