Problème dans un code PHP :(

Fermé
Foxriver36 - 16 avril 2008 à 16:24
 Foxrier36 - 17 avril 2008 à 14:35
Bonjour,

j´ai un problème avec un code PHP
voici le code

/*--function draw_image()--*/

 function draw_image ()



  {



    global $frm;



    global $settings;



    $q = 'select 

				date_format(date_added, \'%b %D, %Y\') as added,

                hl_listings.*

        from

                hl_listings

        where

                (hl_listings.expiration = 0 || date_added + interval hl_listings.expiration day >= current_date)

                and hl_listings.status = 1 and

                id = ' . $frm['lid'];

				

    $sth = mysql_query ($q);

    $row = mysql_fetch_array ($sth);

    if (!$row)

    {	

      header ('Location: ' . $settings['site_logo_url']);

      exit ();

    }



	$group=$row['group_id'];

	$name=$row['name'];

	$status=$row['hyip_status'];


	$var.'\n';

	$Date_1=date("Y-m-d h:i:s"); 

	$Date_2=$row['date_added']; 

	$Date_List_1=explode("-",$Date_1); 

	$Date_List_2=explode("-",$Date_2); 

	$d1=mktime(0,0,0,$Date_List_1[1],$Date_List_1[2],$Date_List_1[0]); 

	$d2=mktime(0,0,0,$Date_List_2[1],$Date_List_2[2],$Date_List_2[0]); 



	//added 

	$added="Added : ".$row['added'];

	//monited xx days

	$Days=round(($d1-$d2)/3600/24); 	

	$monited="Monitored : ".$Days." days";

	



	$img=imagecreatefrompng('images/monitorbutton.png');

	

	$colors = array ();

    $colors['pay'] = imagecolorallocatehex ($img, '#498302');

    $colors['wait'] = imagecolorallocatehex ($img, '#0000FF');

    $colors['problem'] = imagecolorallocatehex ($img, '#FF9900');

    $colors['notpay'] = imagecolorallocatehex ($img, '#FF0000');

	$colors['black'] = imagecolorallocatehex ($img, '#000000');

	



	$colors['name']= imagecolorallocatehex ($img, '#000000');
	$colors['name1']= imagecolorallocatehex ($img, '#0000FF');

	



	$name=((strlen($name)>16) ? substr($name, 0, 13). '...' : $name);



	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(3) * strlen($name)) / 2));



	//ImageTTFText($img, 10, 0, $x+1,63+1, $colors['black'], "images/tahoma.ttf", $name);



	ImageTTFText($img, 10, 0, $x,65, $colors['name1'], "images/tahoma.ttf", $name);



	



	



	



	if ($status == 1)

    {

	 $statuscolor = $colors['pay'];

     $text = 'PAYING';

	 $size=15;

	 $x = floor((ImageSX($img) / 2) - ((ImageFontWidth(5) * strlen($text)) / 2));

	 $x=$x;

    }



    if ($status == 2)

    {

	$statuscolor = $colors['wait'];

	  $text = 'WAITING';

	  $size=15;

	  $x = floor((ImageSX($img) / 2) - ((ImageFontWidth(5) * strlen($text)) / 2));

	  $x=$x;

    }





    if ($status == 3)

    {

	$statuscolor = $colors['problem'];

      $text = 'PROBLEM';

	  $size=15;

	  $x = floor((ImageSX($img) / 2) - ((ImageFontWidth(5) * strlen($text)) / 2));



	  $x=$x-5;

    }



    if ($status == 4)

    {

		$statuscolor = $colors['notpay'];

      $text = 'NOT PAYING';

	  $size=15;

	  $x = floor((ImageSX($img) / 2) - ((ImageFontWidth(5) * strlen($text)) / 2));

	  $x=$x;

    }



	if ($group == 7)

	{

	$statuscolor = $colors['notpay'];

      $text = 'CLOSED';

	  $size=15;

	 $x = floor((ImageSX($img) / 2) - ((ImageFontWidth(5) * strlen($text)) / 2));



	  $x=$x-5;

	}



	//ImageTTFText($img, $size, 0, $x+1,92+1, $colors['black'], "images/impact.ttf", $text);



	ImageTTFText($img, $size, 0, $x,95, $statuscolor, "images/impact.ttf", $text);



	

	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($added)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 105+1, $colors['black'], "images/tahoma.ttff", $monited);

	ImageTTFText($img, 7, 0, $x+5, 112, $colors['name'], "images/tahoma.ttf", $added);

	

	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($monited)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 105+1, $colors['black'], "images/tahoma.ttf", $monited);

	ImageTTFText($img, 7, 0, $x+7, 123, $colors['name'], "images/tahoma.ttf", $monited);

	



	//get listing details	

  $listing = get_listing_details ($row);

  //$listing   

 



 //votes

 	$text="Total Votes : ".$listing['cvotes'].' votes';

	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($text)) / 2));

	//ImageTTFText($img, 10, 0, $x+10+1, 135+1, $colors['black'], "images/tahoma.ttf", $text);

	ImageTTFText($img, 7, 0, $x+9, 134, $colors['name'], "images/tahoma.ttf", $text);	



 

	//user' rating

	

	$text="User Rating : ".$listing['avg_vote']." pts";

	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($text)) / 2));

	//ImageTTFText($img, 10, 0, $x+10+1, 135+1, $colors['black'], "images/tahoma.ttf", $text);

	ImageTTFText($img, 7, 0, $x+8, 145, $colors['name'], "images/tahoma.ttf", $text);	

	

	$text='Our Invest : $'.$listing['spend'].'';

  	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($text)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 120+1, $colors['black'], "images/tahoma.ttf", $text);

	ImageTTFText($img, 7, 0, $x+2, 156, $colors['name'], "images/tahoma.ttf", $text);



	

  	$text='Payout Ratio : '.($listing['ratio']*100).'%';

  	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($text)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 120+1, $colors['black'], "images/tahoma.ttf", $text);

	ImageTTFText($img, 7, 0, $x-8, 167, $colors['name'], "images/tahoma.ttf", $text);



	//lastpayout

$q = "select 

			date_format(hl_statistics.date, '%b %d') as date 

	from 

			`hl_statistics` 

	where 

			type = 1 and listing_id = " . $frm['lid'] ."

	order by

			hl_statistics.date DESC LIMIT 1";

			

	if (!($sth = mysql_query ($q)))

    {

      exit (mysql_error ());

    }

			

    $row = mysql_fetch_array ($sth);

    if (!$row)

    {	

      $lastpayout = 'Last payout : No';      

    }

	else

	{

		$lastpayout = 'Last payout :'.$row['date'];

	}

	 



 //lastpayout end		



	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($lastpayout)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 150+1, $colors['black'], "images/tahoma.ttf", $lastpayout);

	ImageTTFText($img, 7, 0, $x-5, 178, $colors['name'], "images/tahoma.ttf", $lastpayout);


	$text='Today is : '.date("M j,Y");;

  	$x = floor((ImageSX($img) / 2) - ((ImageFontWidth(1) * strlen($text)) / 2));

	//ImageTTFText($img, 10, 0, $x+1, 120+1, $colors['black'], "images/tahoma.ttf", $text);

	ImageTTFText($img, 7, 0, $x+8, 195, $colors['name'], "images/tahoma.ttf", $text);



	header("Content-type: image/png");



	imagepng($img);







  }



le resultat est ceci :
http://img178.imageshack.us/img178/1056/sanstitrenn2.jpg

vous voyer que l´écriture n´est pas à la ligne que je voudrai dans l´image,
voici un exemple comment je veux
http://img171.imageshack.us/img171/9720/indexphpqb2.png

je veux placer ces mots dfgdfg, waiting dans la premieure photo, a la place de la deuxième photo, la meme place
le code au dessus est le code qui me donne le resultat de la première photo
dfgdfg = orientinvestement
waiting = paying
les autres au milieu


quelqu´un peux faire pour moi ce plaisir svp ?
A voir également:

2 réponses

svp je veux d´aide
0
personne veux maider :O:O:O
0