cvs: pear /PECL/imagick imagick.c imagick.h package.xml php_imagick.h /PECL/imagick/examples newimagelist.php poplist.php pushlist.php
| From: | Michael C. Montero | Date: | Mon, 17 Feb 2003 16:42:54 +0000 |
| Subject: | cvs: pear /PECL/imagick imagick.c imagick.h package.xml php_imagick.h /PECL/imagick/examples newimagelist.php poplist.php pushlist.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8915@lists.php.net to get a copy of this message | ||
mcmontero Mon Feb 17 11:42:54 2003 EDT
Added files:
/pear/PECL/imagick/examples newimagelist.php poplist.php
pushlist.php
Modified files:
/pear/PECL/imagick imagick.c imagick.h package.xml php_imagick.h
Log:
- functions added:
imagick_newimagelist()
imagick_pushlist()
imagick_poplist()
- modified how all functions check to see if ImageMagick has been initialized.
- added a number of new examples for demonstrating how to use image lists.
Index: pear/PECL/imagick/imagick.c diff -u pear/PECL/imagick/imagick.c:1.32 pear/PECL/imagick/imagick.c:1.33 --- pear/PECL/imagick/imagick.c:1.32 Wed Jan 22 18:44:16 2003 +++ pear/PECL/imagick/imagick.c Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.c,v 1.32 2003/01/22 23:44:16 mcmontero Exp $ + $Id: imagick.c,v 1.33 2003/02/17 16:42:53 mcmontero Exp $ */ #ifdef HAVE_CONFIG_H @@ -51,6 +51,7 @@ PHP_FE( imagick_image2blob, NULL ) PHP_FE( imagick_blob2image, NULL ) PHP_FE( imagick_getcanvas, NULL ) + PHP_FE( imagick_newimagelist, NULL ) /***** @@ -203,6 +204,8 @@ PHP_FE( imagick_getlistsize, NULL ) PHP_FE( imagick_getlistindex, NULL ) PHP_FE( imagick_getimagefromlist, NULL ) + PHP_FE( imagick_pushlist, NULL ) + PHP_FE( imagick_poplist, NULL ) /***** @@ -975,16 +978,7 @@ return ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -1014,16 +1008,7 @@ return ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -1055,6 +1040,23 @@ RETURN_RESOURCE( handle->id ) ; } +PHP_FUNCTION( imagick_newimagelist ) +{ + imagick_t* handle ; /* the handle for the image list */ + + _php_imagick_init() ; + + handle = _php_imagick_alloc_handle() ; + if ( !handle ) + { + RETURN_FALSE ; + } + handle->id = zend_list_insert( handle, le_imagick_handle ) ; + + handle->image = NewImageList() ; + RETURN_RESOURCE( handle->id ) ; +} + /*****************************************************************************/ /****************************************************************************** @@ -4346,6 +4348,108 @@ RETURN_RESOURCE( new_handle->id ) ; } +PHP_FUNCTION( imagick_pushlist ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + zval* push_handle_id ; /* the handle identifier for the + image to push onto the list */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* push_handle ; /* the actual imagick_t struct for the + handle containing the image to + push */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rr", + &handle_id, &push_handle_id ) == FAILURE ) + { + return ; + } + + handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ; + if ( !handle ) + { + php_error( E_WARNING, "%s(): handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + push_handle = _php_imagick_get_handle_struct_from_list( &push_handle_id TSRMLS_CC ) ; + if ( !push_handle ) + { + php_error( E_WARNING, "%s(): push_handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_clear_errors( handle ) ; + _php_imagick_clear_errors( push_handle ) ; + + PushImageList( &handle->image, push_handle->image, + &handle->exception ) ; + if ( _php_imagick_is_error( handle ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( push_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_TRUE ; +} + +PHP_FUNCTION( imagick_poplist ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* popped_handle ; /* the handle containing the popped + image */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "r", + &handle_id ) == FAILURE ) + { + return ; + } + + handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ; + if ( !handle ) + { + php_error( E_WARNING, "%s(): handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_init() ; + + popped_handle = _php_imagick_alloc_handle() ; + if ( !popped_handle ) + { + RETURN_FALSE ; + } + popped_handle->id = zend_list_insert( popped_handle, + le_imagick_handle ) ; + + _php_imagick_clear_errors( handle ) ; + _php_imagick_clear_errors( popped_handle ) ; + + popped_handle->image = PopImageList( &handle->image ) ; + if ( _php_imagick_is_error( handle ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( popped_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_RESOURCE( popped_handle->id ) ; +} + /*****************************************************************************/ /****************************************************************************** @@ -4853,7 +4957,8 @@ static void _php_imagick_init( void ) { - TSRMLS_FETCH(); + TSRMLS_FETCH() ; + if ( IMAGICK_G( imagick_was_init ) == 1 ) { return ; @@ -4881,7 +4986,7 @@ { imagick_t* handle ; /* the new handle to create */ - TSRMLS_FETCH(); + TSRMLS_FETCH() ; handle = ( imagick_t* )emalloc( sizeof( imagick_t ) ) ; if ( !handle ) @@ -4987,7 +5092,19 @@ } handle->exception.severity = UndefinedException ; - handle->image->exception.severity = UndefinedException ; + + /***** + + It is possible for a handle to be valid but the image object + within it to be NULL. This is true whenever you allocate a + new image list. + + *****/ + + if ( handle->image ) + { + handle->image->exception.severity = UndefinedException ; + } /***** @@ -5021,22 +5138,14 @@ { imagick_t* handle ; /* the new image handle */ - TSRMLS_FETCH(); + TSRMLS_FETCH() ; + if ( !file_name ) { return NULL ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -5064,7 +5173,7 @@ static int _php_imagick_first_image_in_list( imagick_t* handle ) { - TSRMLS_FETCH(); + TSRMLS_FETCH() ; if ( !handle ) { Index: pear/PECL/imagick/imagick.h diff -u pear/PECL/imagick/imagick.h:1.9 pear/PECL/imagick/imagick.h:1.10 --- pear/PECL/imagick/imagick.h:1.9 Sat Jan 4 06:55:58 2003 +++ pear/PECL/imagick/imagick.h Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.h,v 1.9 2003/01/04 11:55:58 mj Exp $ + $Id: imagick.h,v 1.10 2003/02/17 16:42:53 mcmontero Exp $ */ #ifndef IMAGICKH @@ -24,7 +24,7 @@ #include <magick/api.h> - #define IMAGICK_VERSION "0.9.4" + #define IMAGICK_VERSION "0.9.5" #define IMAGICK_TURN_OFF_ERRORS_TO_STDERR 1 #define IMAGICK_FILTER_UNKNOWN -1 #define IMAGICK_DEPCREATED() php_error( E_WARNING, "%s(): this function is deprecated and will be removed soon", get_active_function_name( TSRMLS_C ) ) ; Index: pear/PECL/imagick/package.xml diff -u pear/PECL/imagick/package.xml:1.40 pear/PECL/imagick/package.xml:1.41 --- pear/PECL/imagick/package.xml:1.40 Wed Jan 29 10:09:30 2003 +++ pear/PECL/imagick/package.xml Mon Feb 17 11:42:53 2003 @@ -23,6 +23,20 @@ <license>PHP License</license> <release> + <version>0.9.5</version> + <date>2003-02-xx</date> + <notes> +- functions added: + imagick_newimagelist() + imagick_pushlist() + imagick_poplist() +- modified how all functions check to see if ImageMagick has been initialized. +- added a number of new examples for demonstrating how to use image lists. + </notes> + <state>beta</state> + </release> + + <release> <version>0.9.4</version> <date>2003-01-24</date> <notes> Index: pear/PECL/imagick/php_imagick.h diff -u pear/PECL/imagick/php_imagick.h:1.20 pear/PECL/imagick/php_imagick.h:1.21 --- pear/PECL/imagick/php_imagick.h:1.20 Wed Jan 22 18:44:16 2003 +++ pear/PECL/imagick/php_imagick.h Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: php_imagick.h,v 1.20 2003/01/22 23:44:16 mcmontero Exp $ + $Id: php_imagick.h,v 1.21 2003/02/17 16:42:53 mcmontero Exp $ */ #ifndef PHP_IMAGICK_H @@ -63,6 +63,7 @@ PHP_FUNCTION( imagick_image2blob ) ; PHP_FUNCTION( imagick_blob2image ) ; PHP_FUNCTION( imagick_getcanvas ) ; + PHP_FUNCTION( imagick_newimagelist ) ; /***** @@ -215,6 +216,8 @@ PHP_FUNCTION( imagick_getlistsize ) ; PHP_FUNCTION( imagick_getlistindex ) ; PHP_FUNCTION( imagick_getimagefromlist ) ; + PHP_FUNCTION( imagick_pushlist ) ; + PHP_FUNCTION( imagick_poplist ) ; /***** Index: pear/PECL/imagick/examples/newimagelist.php +++ pear/PECL/imagick/examples/newimagelist.php <? $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Failed to get new image list!<BR>" ; exit ; } print "OK, got new image list.<BR>" ; ?> Index: pear/PECL/imagick/examples/poplist.php +++ pear/PECL/imagick/examples/poplist.php <? $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Uh-Oh! Didn't get new image list.<BR>" ; exit ; } imagick_pushlist( $image_list, $handle ) ; $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } imagick_pushlist( $image_list, $handle ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) . "<BR>" ; $popped_handle = imagick_poplist( $image_list ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) . "<BR>" ; ?> Index: pear/PECL/imagick/examples/pushlist.php +++ pear/PECL/imagick/examples/pushlist.php <? $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Uh-Oh! Didn't get new image list.<BR>" ; exit ; } imagick_pushlist( $image_list, $handle ) ; $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } imagick_pushlist( $image_list, $handle ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) ; ?>
Index: pear/PECL/imagick/imagick.c diff -u pear/PECL/imagick/imagick.c:1.32 pear/PECL/imagick/imagick.c:1.33 --- pear/PECL/imagick/imagick.c:1.32 Wed Jan 22 18:44:16 2003 +++ pear/PECL/imagick/imagick.c Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.c,v 1.32 2003/01/22 23:44:16 mcmontero Exp $ + $Id: imagick.c,v 1.33 2003/02/17 16:42:53 mcmontero Exp $ */ #ifdef HAVE_CONFIG_H @@ -51,6 +51,7 @@ PHP_FE( imagick_image2blob, NULL ) PHP_FE( imagick_blob2image, NULL ) PHP_FE( imagick_getcanvas, NULL ) + PHP_FE( imagick_newimagelist, NULL ) /***** @@ -203,6 +204,8 @@ PHP_FE( imagick_getlistsize, NULL ) PHP_FE( imagick_getlistindex, NULL ) PHP_FE( imagick_getimagefromlist, NULL ) + PHP_FE( imagick_pushlist, NULL ) + PHP_FE( imagick_poplist, NULL ) /***** @@ -975,16 +978,7 @@ return ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -1014,16 +1008,7 @@ return ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -1055,6 +1040,23 @@ RETURN_RESOURCE( handle->id ) ; } +PHP_FUNCTION( imagick_newimagelist ) +{ + imagick_t* handle ; /* the handle for the image list */ + + _php_imagick_init() ; + + handle = _php_imagick_alloc_handle() ; + if ( !handle ) + { + RETURN_FALSE ; + } + handle->id = zend_list_insert( handle, le_imagick_handle ) ; + + handle->image = NewImageList() ; + RETURN_RESOURCE( handle->id ) ; +} + /*****************************************************************************/ /****************************************************************************** @@ -4346,6 +4348,108 @@ RETURN_RESOURCE( new_handle->id ) ; } +PHP_FUNCTION( imagick_pushlist ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + zval* push_handle_id ; /* the handle identifier for the + image to push onto the list */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* push_handle ; /* the actual imagick_t struct for the + handle containing the image to + push */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rr", + &handle_id, &push_handle_id ) == FAILURE ) + { + return ; + } + + handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ; + if ( !handle ) + { + php_error( E_WARNING, "%s(): handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + push_handle = _php_imagick_get_handle_struct_from_list( &push_handle_id TSRMLS_CC ) ; + if ( !push_handle ) + { + php_error( E_WARNING, "%s(): push_handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_clear_errors( handle ) ; + _php_imagick_clear_errors( push_handle ) ; + + PushImageList( &handle->image, push_handle->image, + &handle->exception ) ; + if ( _php_imagick_is_error( handle ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( push_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_TRUE ; +} + +PHP_FUNCTION( imagick_poplist ) +{ + zval* handle_id ; /* the handle identifier coming from + the PHP environment */ + imagick_t* handle ; /* the actual imagick_t struct for the + handle */ + imagick_t* popped_handle ; /* the handle containing the popped + image */ + + if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "r", + &handle_id ) == FAILURE ) + { + return ; + } + + handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ; + if ( !handle ) + { + php_error( E_WARNING, "%s(): handle is invalid", + get_active_function_name( TSRMLS_C ) ) ; + RETURN_FALSE ; + } + + _php_imagick_init() ; + + popped_handle = _php_imagick_alloc_handle() ; + if ( !popped_handle ) + { + RETURN_FALSE ; + } + popped_handle->id = zend_list_insert( popped_handle, + le_imagick_handle ) ; + + _php_imagick_clear_errors( handle ) ; + _php_imagick_clear_errors( popped_handle ) ; + + popped_handle->image = PopImageList( &handle->image ) ; + if ( _php_imagick_is_error( handle ) ) + { + RETURN_FALSE ; + } + + if ( _php_imagick_is_error( popped_handle ) ) + { + RETURN_FALSE ; + } + + RETURN_RESOURCE( popped_handle->id ) ; +} + /*****************************************************************************/ /****************************************************************************** @@ -4853,7 +4957,8 @@ static void _php_imagick_init( void ) { - TSRMLS_FETCH(); + TSRMLS_FETCH() ; + if ( IMAGICK_G( imagick_was_init ) == 1 ) { return ; @@ -4881,7 +4986,7 @@ { imagick_t* handle ; /* the new handle to create */ - TSRMLS_FETCH(); + TSRMLS_FETCH() ; handle = ( imagick_t* )emalloc( sizeof( imagick_t ) ) ; if ( !handle ) @@ -4987,7 +5092,19 @@ } handle->exception.severity = UndefinedException ; - handle->image->exception.severity = UndefinedException ; + + /***** + + It is possible for a handle to be valid but the image object + within it to be NULL. This is true whenever you allocate a + new image list. + + *****/ + + if ( handle->image ) + { + handle->image->exception.severity = UndefinedException ; + } /***** @@ -5021,22 +5138,14 @@ { imagick_t* handle ; /* the new image handle */ - TSRMLS_FETCH(); + TSRMLS_FETCH() ; + if ( !file_name ) { return NULL ; } - if ( IMAGICK_G( imagick_was_init ) == 0 ) - { - /***** - - Initialize the ImageMagick engine. - - *****/ - - _php_imagick_init() ; - } + _php_imagick_init() ; handle = _php_imagick_alloc_handle() ; if ( !handle ) @@ -5064,7 +5173,7 @@ static int _php_imagick_first_image_in_list( imagick_t* handle ) { - TSRMLS_FETCH(); + TSRMLS_FETCH() ; if ( !handle ) { Index: pear/PECL/imagick/imagick.h diff -u pear/PECL/imagick/imagick.h:1.9 pear/PECL/imagick/imagick.h:1.10 --- pear/PECL/imagick/imagick.h:1.9 Sat Jan 4 06:55:58 2003 +++ pear/PECL/imagick/imagick.h Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: imagick.h,v 1.9 2003/01/04 11:55:58 mj Exp $ + $Id: imagick.h,v 1.10 2003/02/17 16:42:53 mcmontero Exp $ */ #ifndef IMAGICKH @@ -24,7 +24,7 @@ #include <magick/api.h> - #define IMAGICK_VERSION "0.9.4" + #define IMAGICK_VERSION "0.9.5" #define IMAGICK_TURN_OFF_ERRORS_TO_STDERR 1 #define IMAGICK_FILTER_UNKNOWN -1 #define IMAGICK_DEPCREATED() php_error( E_WARNING, "%s(): this function is deprecated and will be removed soon", get_active_function_name( TSRMLS_C ) ) ; Index: pear/PECL/imagick/package.xml diff -u pear/PECL/imagick/package.xml:1.40 pear/PECL/imagick/package.xml:1.41 --- pear/PECL/imagick/package.xml:1.40 Wed Jan 29 10:09:30 2003 +++ pear/PECL/imagick/package.xml Mon Feb 17 11:42:53 2003 @@ -23,6 +23,20 @@ <license>PHP License</license> <release> + <version>0.9.5</version> + <date>2003-02-xx</date> + <notes> +- functions added: + imagick_newimagelist() + imagick_pushlist() + imagick_poplist() +- modified how all functions check to see if ImageMagick has been initialized. +- added a number of new examples for demonstrating how to use image lists. + </notes> + <state>beta</state> + </release> + + <release> <version>0.9.4</version> <date>2003-01-24</date> <notes> Index: pear/PECL/imagick/php_imagick.h diff -u pear/PECL/imagick/php_imagick.h:1.20 pear/PECL/imagick/php_imagick.h:1.21 --- pear/PECL/imagick/php_imagick.h:1.20 Wed Jan 22 18:44:16 2003 +++ pear/PECL/imagick/php_imagick.h Mon Feb 17 11:42:53 2003 @@ -16,7 +16,7 @@ | Christian Stocker (chregu@bitflux.ch) | +----------------------------------------------------------------------+ - $Id: php_imagick.h,v 1.20 2003/01/22 23:44:16 mcmontero Exp $ + $Id: php_imagick.h,v 1.21 2003/02/17 16:42:53 mcmontero Exp $ */ #ifndef PHP_IMAGICK_H @@ -63,6 +63,7 @@ PHP_FUNCTION( imagick_image2blob ) ; PHP_FUNCTION( imagick_blob2image ) ; PHP_FUNCTION( imagick_getcanvas ) ; + PHP_FUNCTION( imagick_newimagelist ) ; /***** @@ -215,6 +216,8 @@ PHP_FUNCTION( imagick_getlistsize ) ; PHP_FUNCTION( imagick_getlistindex ) ; PHP_FUNCTION( imagick_getimagefromlist ) ; + PHP_FUNCTION( imagick_pushlist ) ; + PHP_FUNCTION( imagick_poplist ) ; /***** Index: pear/PECL/imagick/examples/newimagelist.php +++ pear/PECL/imagick/examples/newimagelist.php <? $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Failed to get new image list!<BR>" ; exit ; } print "OK, got new image list.<BR>" ; ?> Index: pear/PECL/imagick/examples/poplist.php +++ pear/PECL/imagick/examples/poplist.php <? $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Uh-Oh! Didn't get new image list.<BR>" ; exit ; } imagick_pushlist( $image_list, $handle ) ; $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } imagick_pushlist( $image_list, $handle ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) . "<BR>" ; $popped_handle = imagick_poplist( $image_list ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) . "<BR>" ; ?> Index: pear/PECL/imagick/examples/pushlist.php +++ pear/PECL/imagick/examples/pushlist.php <? $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } $image_list = imagick_newimagelist() ; if ( !$image_list ) { print "Uh-Oh! Didn't get new image list.<BR>" ; exit ; } imagick_pushlist( $image_list, $handle ) ; $handle = imagick_readimage( "./image.jpg" ) ; if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ; exit ; } imagick_pushlist( $image_list, $handle ) ; print "Total images in list: " . imagick_getlistsize( $image_list ) ; ?>