| [ Index ] |
PHP Cross Reference of Wordpress 2.9.1 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Default_Theme 5 */ 6 7 /** @ignore */ 8 $img = 'kubrickheader.jpg'; 9 10 // If we don't have image processing support, redirect. 11 if ( ! function_exists('imagecreatefromjpeg') ) 12 die(header("Location: kubrickheader.jpg")); 13 14 // Assign and validate the color values 15 $default = false; 16 $vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2')); 17 foreach ( $vars as $var => $subvars ) { 18 if ( isset($_GET[$var]) ) { 19 foreach ( $subvars as $index => $subvar ) { 20 $length = strlen($_GET[$var]) / 3; 21 $v = substr($_GET[$var], $index * $length, $length); 22 if ( $length == 1 ) $v = '' . $v . $v; 23 $$subvar = hexdec( $v ); 24 if ( $$subvar < 0 || $$subvar > 255 ) 25 $default = true; 26 } 27 } else { 28 $default = true; 29 } 30 } 31 32 if ( $default ) 33 list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 ); 34 35 // Create the image 36 $im = imagecreatefromjpeg($img); 37 38 // Get the background color, define the rectangle height 39 $white = imagecolorat( $im, 15, 15 ); 40 $h = 182; 41 42 // Define the boundaries of the rounded edges ( y => array ( x1, x2 ) ) 43 $corners = array( 44 0 => array ( 25, 734 ), 45 1 => array ( 23, 736 ), 46 2 => array ( 22, 737 ), 47 3 => array ( 21, 738 ), 48 4 => array ( 21, 738 ), 49 177 => array ( 21, 738 ), 50 178 => array ( 21, 738 ), 51 179 => array ( 22, 737 ), 52 180 => array ( 23, 736 ), 53 181 => array ( 25, 734 ), 54 ); 55 56 // Blank out the blue thing 57 for ( $i = 0; $i < $h; $i++ ) { 58 $x1 = 19; 59 $x2 = 740; 60 imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white ); 61 } 62 63 // Draw a new color thing 64 for ( $i = 0; $i < $h; $i++ ) { 65 $x1 = 20; 66 $x2 = 739; 67 $r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1; 68 $g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1; 69 $b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1; 70 $color = imagecolorallocate( $im, $r, $g, $b ); 71 if ( array_key_exists($i, $corners) ) { 72 imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white ); 73 list ( $x1, $x2 ) = $corners[$i]; 74 } 75 imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color ); 76 } 77 78 //die; 79 header("Content-Type: image/jpeg"); 80 imagejpeg($im, '', 92); 81 imagedestroy($im); 82 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 8 00:19:48 2010 | Cross-referenced by PHPXref 0.7 |