All pastes #534076 Raw Edit

Something

public text v1 · immutable
·published 2007-06-03 17:34 UTC
rendered paste body
<?php

    // Get the XML data from Feedburner
    $xml = simplexml_load_file('http://www.sportsnet.ca/rss/homepage.xml');
//$text_out = explode(" ", $text);
  


 
 $font_regular = "/usr/share/fonts/truetype/cisco/CISCOLIG.TTF";
   
     // $size_regular = ‘10&#8242;;
  
    // word_wrap() function.
    function word_wrap($text) {
        // Define the characters to display per row
        $chars = "20";
        $text = wordwrap($text, $chars, " " , 1);
        return $text;
    }
    
    
    
    // Parse each item in the RSS feed
    foreach ($xml->channel[0]->item as $item) {
        if($item) {
            $title = strip_tags($item->title);
            $description = strip_tags($item->description);              
        $des = "Scott Barney scored two haf af goals to help the defending AHL-champion Hershey Bears beat the Hamilton Bulldogs 4-2 on Saturday night, tying the Calder Cup final 1-1.";
        if($des == $description){
        echo "it is the same"; exit;}
        
        else {
        print "it is not same";
        }
            $img = imagecreatefromgif('cisco.gif');      
            $color = imagecolorallocate($img, 0x00, 0x66, 0xCC);
$txt_color = imagecolorallocate($img, 0x12 ,0x07 ,0x07 );
            $text = word_wrap($description);
            //
            
            
           // imagestring($img, 3, 1, 2, $title, $color);
            //$title=explode(" ",$title);
           $value= explode(" ",$text,16);
            //$str =  array($value);
        //$white = imagecolorallocate( $image, 255, 255, 255 );       
     
imagettftext( $img , 9 , 0 , 8, 50, $txt_color , $font_regular, $title );
imagettftext( $img , 9 , 0 , 8, 70, $txt_color , $font_regular, $$value[0]." ".$value[1]." ".$value[2]." " .$value[3]." ".$value[4] );
imagettftext( $img , 9 , 0 , 8, 90, $txt_color , $font_regular,$value[5]." ".$value[6]." ".$value[7]." " .$value[8]." ".$value[9]."  . . . ");
//imagettftext( $img , 9 , 0 , 8, 70, $txt_color , $font_regular, $value[0],value[1],);            
//imagestring($img, 1 , 1, 50 ,$title, $color);
//imagestring($img, 1, 1, 60, $value[0]." ".$value[1]." ".$value[2]." " .$value[3], $color);
//imagestring($img, 1, 1, 70 , $value[4]." ".$value[5]." ".$value[6]." " .$value[7], $color);
//imagestring($img, 1, 1, 80 , $value[8]." ".$value[9]." ".$value[10]." " .$value[11], $color);
//imagestring($img, 1, 1, 90 , $value[12]." ".$value[13]." ".$value[14]." " .$value[15], $color);
//imagestring($img, 1 , 1, 60 ,$value[2] , $color);
//imagestring($img, 1 , 1, 70 ,$value[3] , $color);  
//imagestring($img, 1 , 1, 80 ,$value[4] , $color);
//imagestring($img, 1 , 1, 90 ,$value[5] , $color);
            echo "<html><head>\n<title>Test Text to Image</title>\n";
            echo "</head><body>\n";


	
            
         imagegif($img,"feedburner-readers.gif") ; 
         imagegif($img,"/var/www/bill1/frames") ;
     
            //echo "$description";
            
            {
             
             
             //  echo "<p>Image not created!</p>";
             
            
$des = $description;
 echo "$des";            //echo "\n</body></html>";

include "GIFEncoder.class.php";

/*

	Build a frames array from sources...

*/

if ( $dh = opendir ( "frames/" ) ) {

	while ( false !== ( $dat = readdir ( $dh ) ) ) {

		if ( $dat != "." && $dat != ".." ) {

			$frames [ ] = "frames/$dat";

			$framed [ ] = 200;

		}

	}

	closedir ( $dh );

}

/*

		GIFEncoder constructor:

        =======================



		image_stream = new GIFEncoder	(

							URL or Binary data	'Sources'

							int					'Delay times'

							int					'Animation loops'

							int					'Disposal'

							int					'Transparent red, green, blue colors'

							int					'Source type'

						);

*/

$gif = new GIFEncoder	(

							$frames,

							$framed,

							0,

							2,

							1, 1, 1,

							"url"

		);
		
//$date=gmdate("D-M-Y-H:i", time());

//echo "$date";
//$d= date('r', $timestamp);
/*



		Possibles outputs:

		==================

//$date=gmdate("D M Y H:i", time() + $zone);

        Output as GIF for browsers :

        	- Header ( 'Content-type:image/gif' );

        Output as GIF for browsers with filename:

        	- Header ( 'Content-disposition:Attachment;filename=myanimation.gif');

        Output as file to store into a specified file:*/





FWrite ( FOpen ("filename.gif" , "www/bill" ), $gif->GetAnimation ( ) );



//Header ( 'Content-type:image/gif' );

 //echo	$gif->GetAnimation ( );
exit;
 
  }          

}
}

?>