/ Published in: PHP
Since PHP doesn't have a builtin imagecreatefrombmp, this allows users to upload bmp files and you can handle them and create a different image type from it.
Expand |
Embed | Plain Text
/** * Creates function imagecreatefrombmp, since PHP doesn't have one * @return resource An image identifier, similar to imagecreatefrompng * @param string $filename Path to the BMP image * @see imagecreatefrompng * @author Glen Solsberry <glens@networldalliance.com> */ function imagecreatefrombmp( $filename ) { { } $hex = $temp[1]; { // Remove some stuff? // Get the width // Remove some stuff? // Get the height } $x = 0; $y = 1; $image = imagecreatetruecolor( $width, $height ); foreach( $body as $rgb ) { $color = imagecolorallocate( $image, $r, $g, $b ); imagesetpixel( $image, $x, $height-$y, $color ); $x++; if( $x >= $width ) { $x = 0; $y++; } } return $image; } }
You need to login to post a comment.
