Set eol-style

git-svn-id: http://svn.automattic.com/wordpress/trunk@8340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-15 15:59:19 +00:00
parent 9ce9fec7c4
commit 482fcca10a
1 changed files with 67 additions and 67 deletions

View File

@ -1,77 +1,77 @@
<?php <?php
$img = 'kubrickheader.jpg'; $img = 'kubrickheader.jpg';
// If we don't have image processing support, redirect. // If we don't have image processing support, redirect.
if ( ! function_exists('imagecreatefromjpeg') ) if ( ! function_exists('imagecreatefromjpeg') )
die(header("Location: kubrickheader.jpg")); die(header("Location: kubrickheader.jpg"));
// Assign and validate the color values // Assign and validate the color values
$default = false; $default = false;
$vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2')); $vars = array('upper'=>array('r1', 'g1', 'b1'), 'lower'=>array('r2', 'g2', 'b2'));
foreach ( $vars as $var => $subvars ) { foreach ( $vars as $var => $subvars ) {
if ( isset($_GET[$var]) ) { if ( isset($_GET[$var]) ) {
foreach ( $subvars as $index => $subvar ) { foreach ( $subvars as $index => $subvar ) {
$length = strlen($_GET[$var]) / 3; $length = strlen($_GET[$var]) / 3;
$v = substr($_GET[$var], $index * $length, $length); $v = substr($_GET[$var], $index * $length, $length);
if ( $length == 1 ) $v = '' . $v . $v; if ( $length == 1 ) $v = '' . $v . $v;
$$subvar = hexdec( $v ); $$subvar = hexdec( $v );
if ( $$subvar < 0 || $$subvar > 255 ) if ( $$subvar < 0 || $$subvar > 255 )
$default = true; $default = true;
} }
} else { } else {
$default = true; $default = true;
} }
} }
if ( $default ) if ( $default )
list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 ); list ( $r1, $g1, $b1, $r2, $g2, $b2 ) = array ( 105, 174, 231, 65, 128, 182 );
// Create the image // Create the image
$im = imagecreatefromjpeg($img); $im = imagecreatefromjpeg($img);
// Get the background color, define the rectangle height // Get the background color, define the rectangle height
$white = imagecolorat( $im, 15, 15 ); $white = imagecolorat( $im, 15, 15 );
$h = 182; $h = 182;
// Define the boundaries of the rounded edges ( y => array ( x1, x2 ) ) // Define the boundaries of the rounded edges ( y => array ( x1, x2 ) )
$corners = array( $corners = array(
0 => array ( 25, 734 ), 0 => array ( 25, 734 ),
1 => array ( 23, 736 ), 1 => array ( 23, 736 ),
2 => array ( 22, 737 ), 2 => array ( 22, 737 ),
3 => array ( 21, 738 ), 3 => array ( 21, 738 ),
4 => array ( 21, 738 ), 4 => array ( 21, 738 ),
177 => array ( 21, 738 ), 177 => array ( 21, 738 ),
178 => array ( 21, 738 ), 178 => array ( 21, 738 ),
179 => array ( 22, 737 ), 179 => array ( 22, 737 ),
180 => array ( 23, 736 ), 180 => array ( 23, 736 ),
181 => array ( 25, 734 ), 181 => array ( 25, 734 ),
); );
// Blank out the blue thing // Blank out the blue thing
for ( $i = 0; $i < $h; $i++ ) { for ( $i = 0; $i < $h; $i++ ) {
$x1 = 19; $x1 = 19;
$x2 = 740; $x2 = 740;
imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white ); imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
} }
// Draw a new color thing // Draw a new color thing
for ( $i = 0; $i < $h; $i++ ) { for ( $i = 0; $i < $h; $i++ ) {
$x1 = 20; $x1 = 20;
$x2 = 739; $x2 = 739;
$r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1; $r = ( $r2 - $r1 != 0 ) ? $r1 + ( $r2 - $r1 ) * ( $i / $h ) : $r1;
$g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1; $g = ( $g2 - $g1 != 0 ) ? $g1 + ( $g2 - $g1 ) * ( $i / $h ) : $g1;
$b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1; $b = ( $b2 - $b1 != 0 ) ? $b1 + ( $b2 - $b1 ) * ( $i / $h ) : $b1;
$color = imagecolorallocate( $im, $r, $g, $b ); $color = imagecolorallocate( $im, $r, $g, $b );
if ( array_key_exists($i, $corners) ) { if ( array_key_exists($i, $corners) ) {
imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white ); imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $white );
list ( $x1, $x2 ) = $corners[$i]; list ( $x1, $x2 ) = $corners[$i];
} }
imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color ); imageline( $im, $x1, 18 + $i, $x2, 18 + $i, $color );
} }
//die; //die;
header("Content-Type: image/jpeg"); header("Content-Type: image/jpeg");
imagejpeg($im, '', 92); imagejpeg($im, '', 92);
imagedestroy($im); imagedestroy($im);
?> ?>