note 108995 deleted from function.imagecreate by danbrown

From: Date: Wed, 13 Jun 2012 15:27:58 +0000
Subject: note 108995 deleted from function.imagecreate by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188576@lists.php.net to get a copy of this message
Note Submitter: Philipz ---- function ImageCreateFromBMP($filename) if ($BMP['colors'] < 257) // to only handle 8-bit and less palettes { $used_colors = ( $BMP['colors_used'] ) ? $BMP['colors_used'] : $BMP['colors']; // incase all the colors arent used in the palette $PALETTE = unpack('V'.$used_colors, fread($f1,$used_colors*4)); // to convert negative signed integer numbers to unsigned foreach ( $PALETTE as $key => $value ) { if ( $value < 0 ) $PALETTE[$key] += 16777216; } } fseek( $f1, $FILE['bitmap_offset'] ); // make sure the image data is read from the correct location

« previous php.notes (#188576) next »