class.upload.php version 0.25 released
I am pleased to announce the release of the version 0.25 of the script class.upload.php. It is a major update, with a substantial rewrite of the image manipulation code, internationalization, and a wide range of new features and improvements.
Support for transparency and true color images has been greatly enhanced. The class now sports a great number of new features: support for BMP files, file information available before calling process(), more checks on upload, especially for images, direct output of the file or image to the browser. And last but not least, the class is now fully internationalized, and English, French and Dutch translations are provided!
- added translation files and mechanism to instantiate the class with a language different from English
- added forbidden to set an array of forbidden MIME types
- implemented support for simple wildcards in allowed and forbidden, such as image/*
- preset the file extension to the desired conversion format when converting an image
- added read and write support for BMP images
- added a flag file_is_image to determine if the file is a supported image type
- the class now provides some information about the image, before calling process(). Available are image_src_x, image_src_y and the newly introduced image_src_bits, image_src_pixels and image_src_type. Note that this will not work if open_basedir restrictions are in place
- improved logging; now provides useful system information
- added some more pre-processing checks for files that are images: image_max_width, image_max_height, image_max_pixels, image_max_ratio, image_min_width, image_min_height, image_min_pixels and image_min_ratio
- added image_ratio_pixels to resize an image to a number of pixels, keeping aspect ratio
- added image_is_palette and image_is_transparent and image_transparent_color for GIF images
- added image_default_color to define a fallback color for non alpha-transparent output formats, such as JPEG or BMP
- changed image_background_color, which now forces transparent areas to be painted
- improved reflections and color overlays so that it works with alpha transparent images
- image_reflection_color is now deprecated in favour of image_default_color
- transparent PNGs are now processed in true color, and fully preserving the alpha channel when doing merges
- transparent GIFs are now automatically detected. preserve_transparency is deprecated
- transparent true color images can be saved as GIF while retaining transparency, semi transparent areas being merged with image_default_color
- transparent true color images can be saved as JPG/BMP with the semi transparent areas being merged with image_default_color
- fixed conversion of images to true color
- the class can now output the uploaded files content as the return value of process() if the function is called with an empty or null argument, or no argument