Best way to open,crop,rotate and convert a windowsbitmap (bmp)
I like to open a Windows bitmap file within php.
I found some piece of code (imagecreatefrombmp), that converts a bmp to png. But that code is in plain php and to slow. My images have a size around 1000x2000 pixels.
gdlib doesn't open bmp files.
IMagick to complicated to compile and i don't find windows binaries that work with my php.
Additional i like to open that bmp from a string. it is streamed from a db.
I also need to do some rotat开发者_运维百科ions (0, 90, 180, 270) and some cropping.
Finally i like to save it to tiff or png file (or string).
But primary problem, how to open a bmp file?
plattform:
- php 5.2 (vc6,ts) on Windows Cli and Apache 2.2 Module
- zend framework 1.10
You can find precompiled gmagick PHP extension for Windows at valokuva site. The file is named php_gmagick_ts.dll.
The trick is that these are built using VC9 compiler so you will need VC9 version of Apache and PHP as well. If you plan to install PHP as a module, you will need a thread safe (ts) version of gmagick and PHP. You can get Apache built using VC9 from apachelounge, file named httpd-2.2.14-win32-x86-ssl.zip and PHP from PHP web site, file named php-5.3.1-Win32-VC9-x86.msi
gmagick code samples are available in the PHP documentation or in great tutorial at Zend DevZone.
To see all links for this answer go to http://www.google.com/notebook/public/11284522948259357138/BDQo5QwoQqbC67p4i
Enjoy!
精彩评论