Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 8
Initialize the image library
#include <img.h>
int img_lib_attach( img_lib_t* ilib );
- ilib
- The address where the function stores a handle to the library.
img
This function initializes the image library, looks for a configuration file, and loads the codecs listed in that file.
If the function can't find a configuration file, it still fills in a valid library handle, but no codecs are loaded, and images can't be decoded. In this situation, the function returns IMG_ERR_CFG. You can load codecs after library initialization by calling img_cfg_read().
The image library uses a configuration file to determine which codecs to load,
This function first checks the environment variable LIBIMG_CFGFILE, which is the full path for the configuration file. If it isn't set, then checks the default location /etc/system/config/img.conf.
Codecs in the configuration file are specified as sections. Each section of the configuration file is demarcated by the codec name in square brackets, followed by an unordered list of properties specifying additional information about that codec. There should be at least a mimetype line and list of extensions to associate with the codec. For example:
[img_codec_jpg.so]
mime=image/jpeg:image/jpg
ext=jpg:jpeg
|
This example illustrates how to specify multiple entries in the same line, but has been simplified from the original. The default configuration file contains more mimetype entries. |
- IMG_ERR_OK
- Success.
- IMG_ERR_MEM
- Memory-allocation failure.
- IMG_ERR_CFG
- Bad or missing configuration file. The handle returned is still valid, however no codecs have been preloaded.
Image library
Safety: | |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
img_cfg_read(),
img_lib_detach()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 146
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/gf/dev_guide/img/img_lib_attach.html on line 146