GdBmp.php
Copyright (c) 2011, oov. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the oov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. bmp ファイルを GD で使えるように 使用例: //ファイルから読み込む場合はGDでPNGなどを読み込むのと同じような方法で可 $image = imagecreatefrombmp("test.bmp"); imagedestroy($image); //文字列から読み込む場合は以下の方法で可 $image = GdBmp::loadFromString(file_get_contents("test.bmp")); //自動判定されるので破損ファイルでなければこれでも上手くいく //$image = imagecreatefrombmp(file_get_contents("test.bmp")); imagedestroy($image); //その他任意のストリームからの読み込みも可能 $stream = fopen("http://127.0.0.1/test.bmp"); $image = GdBmp::loadFromStream($stream); //自動判定されるのでこれでもいい //$image = imagecreatefrombmp($stream); fclose($stream); imagedestroy($image); 対応フォーマット 1bit 4bit 4bitRLE 8bit 8bitRLE 16bit(任意のビットフィールド) 24bit 32bit(任意のビットフィールド) BITMAPINFOHEADER の biCompression が BI_PNG / BI_JPEG の画像 すべての形式でトップダウン/ボトムアップの両方をサポート 特殊なビットフィールドでもビットフィールドデータが正常なら読み込み可能 以下のものは非対応 BITMAPV4HEADER と BITMAPV5HEADER に含まれる色空間に関する様々な機能
Table of Contents
Classes
Functions
- imagecreatefrombmp() : mixed
Functions
imagecreatefrombmp()
imagecreatefrombmp(mixed $filename_or_stream_or_binary) : mixed
Parameters
- $filename_or_stream_or_binary : mixed