cvs: pear /PECL/imagick imagick.c package.xml php_imagick.h /PECL/imagick/examples setcompression.php setcompressionquality.php
setcompressiontype.php
| From: | Michael C. Montero | Date: | Tue, 18 Feb 2003 18:45:34 +0000 |
| Subject: | cvs: pear /PECL/imagick imagick.c package.xml php_imagick.h /PECL/imagick/examples setcompression.php setcompressionquality.php setcompressiontype.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8949@lists.php.net to get a copy of this message | ||
mcmontero Tue Feb 18 13:45:34 2003 EDT
Added files:
/pear/PECL/imagick/examples setcompressionquality.php
setcompressiontype.php
Removed files:
/pear/PECL/imagick/examples setcompression.php
Modified files:
/pear/PECL/imagick imagick.c package.xml php_imagick.h
Log:
- renamed imagick_setcompression() to imagick_setcompressiontype().
- added function imagick_setcompressionquality().
Index: pear/PECL/imagick/imagick.c
diff -u pear/PECL/imagick/imagick.c:1.35 pear/PECL/imagick/imagick.c:1.36
--- pear/PECL/imagick/imagick.c:1.35 Tue Feb 18 12:41:53 2003
+++ pear/PECL/imagick/imagick.c Tue Feb 18 13:45:34 2003
@@ -16,7 +16,7 @@
| Christian Stocker (chregu@bitflux.ch) |
+----------------------------------------------------------------------+
- $Id: imagick.c,v 1.35 2003/02/18 17:41:53 mcmontero Exp $
+ $Id: imagick.c,v 1.36 2003/02/18 18:45:34 mcmontero Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -89,7 +89,8 @@
*****/
PHP_FE( imagick_convert, NULL )
- PHP_FE( imagick_setcompression, NULL )
+ PHP_FE( imagick_setcompressiontype, NULL )
+ PHP_FE( imagick_setcompressionquality, NULL )
/*****
@@ -1678,7 +1679,7 @@
RETURN_TRUE ;
}
-PHP_FUNCTION( imagick_setcompression )
+PHP_FUNCTION( imagick_setcompressiontype )
{
zval* handle_id ; /* the handle identifier coming from
the PHP environment */
@@ -1708,6 +1709,39 @@
}
handle->image->compression = ( CompressionType )compression_type ;
+ RETURN_TRUE ;
+}
+
+PHP_FUNCTION( imagick_setcompressionquality )
+{
+ zval* handle_id ; /* the handle identifier coming from
+ the PHP environment */
+ long compression_quality ;/* the compression quality to set */
+ imagick_t* handle ; /* the actual imagick_t struct for the
+ handle */
+
+ if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rl",
+ &handle_id, &compression_quality ) == 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_clear_errors( handle ) ;
+
+ if ( handle->image_info == ( ImageInfo* )NULL )
+ {
+ RETURN_FALSE ;
+ }
+
+ handle->image_info->quality = compression_quality ;
RETURN_TRUE ;
}
Index: pear/PECL/imagick/package.xml
diff -u pear/PECL/imagick/package.xml:1.44 pear/PECL/imagick/package.xml:1.45
--- pear/PECL/imagick/package.xml:1.44 Tue Feb 18 12:42:30 2003
+++ pear/PECL/imagick/package.xml Tue Feb 18 13:45:34 2003
@@ -31,16 +31,19 @@
imagick_pushlist()
imagick_poplist()
imagick_mosaic()
- imagick_setcompression()
+ imagick_setcompressiontype()
+ imagick_setcompressionquality()
- 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.
- fixed bugs in _php_imagick_alloc_handle() and _php_imagick_clear_errors()
causing core dump when working with image lists. I wasn't checking to make
sure the structures I was examining were allocated.
- thanks to James Huston (hustonjs@itadevelopment.com) for suggesting
- imagick_setcompression() and testing it.
+ imagick_setcompressiontype() and imagick_setcompressionquality() and
+ testing them.
- added supporting IMAGICK_COMPRESSION_* constants for use with
- imagick_setcompression().
+ imagick_setcompressiontype().
+- renamed imagick_setcompression() to imagick_setcompressiontype().
</notes>
<state>beta</state>
</release>
Index: pear/PECL/imagick/php_imagick.h
diff -u pear/PECL/imagick/php_imagick.h:1.23 pear/PECL/imagick/php_imagick.h:1.24
--- pear/PECL/imagick/php_imagick.h:1.23 Tue Feb 18 12:41:53 2003
+++ pear/PECL/imagick/php_imagick.h Tue Feb 18 13:45:34 2003
@@ -16,7 +16,7 @@
| Christian Stocker (chregu@bitflux.ch) |
+----------------------------------------------------------------------+
- $Id: php_imagick.h,v 1.23 2003/02/18 17:41:53 mcmontero Exp $
+ $Id: php_imagick.h,v 1.24 2003/02/18 18:45:34 mcmontero Exp $
*/
#ifndef PHP_IMAGICK_H
@@ -101,7 +101,8 @@
*****/
PHP_FUNCTION( imagick_convert ) ;
- PHP_FUNCTION( imagick_setcompression ) ;
+ PHP_FUNCTION( imagick_setcompressiontype ) ;
+ PHP_FUNCTION( imagick_setcompressionquality ) ;
/*****
Index: pear/PECL/imagick/examples/setcompressionquality.php
+++ pear/PECL/imagick/examples/setcompressionquality.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 ;
}
imagick_setcompressionquality( $handle, 10 ) ;
if ( !imagick_writeimage( $handle, "./new_image.jpg" ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "imagick_writeimage() failed<BR>\nReason:
$reason<BR>\nDescription: $description<BR>\n" ;
exit ;
}
header( "Location: images_jpg.html" ) ;
?>
Index: pear/PECL/imagick/examples/setcompressiontype.php
+++ pear/PECL/imagick/examples/setcompressiontype.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 ;
}
//
// For the second parameter to imagick_setcompressiontype(), use one of
// these:
//
// IMAGICK_COMPRESSION_UNDEFINED
// IMAGICK_COMPRESSION_NONE
// IMAGICK_COMPRESSION_BZIP
// IMAGICK_COMPRESSION_FAX
// IMAGICK_COMPRESSION_GROUP4
// IMAGICK_COMPRESSION_JPEG
// IMAGICK_COMPRESSION_LOSSLESSJPEG
// IMAGICK_COMPRESSION_LZW
// IMAGICK_COMPRESSION_RLE
// IMAGICK_COMPRESSION_ZIP
//
imagick_setcompressiontype( $handle,
IMAGICK_COMPRESSION_LOSSLESSJPEG ) ;
if ( !imagick_writeimage( $handle, "./new_image.jpg" ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "imagick_writeimage() failed<BR>\nReason:
$reason<BR>\nDescription: $description<BR>\n" ;
exit ;
}
header( "Location: images_jpg.html" ) ;
?>