php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #56011 feature request: some wanted functions
Submitted: 2004-03-22 04:57 UTC Modified: 2007-04-13 11:48 UTC
From: michael at elfimov dot com Assigned:
Status: Suspended Package: imagick (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
39 - 26 = ?
Subscribe to this entry?

 
 [2004-03-22 04:57 UTC] michael at elfimov dot com
Description:
------------
Here is some functions wanted:
imagick_getstorageclass, imagick_getxresolution, imagick_getyresolution, imagick_getunits, imagick_getcompression.
Below are source code then can be added for these functions:

PHP_FUNCTION( imagick_getstorageclass )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */

        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_clear_errors( handle ) ;

        if ( handle->image == ( Image* )NULL )
        {
                RETURN_FALSE ;
        }
        RETURN_LONG( handle->image->storage_class ) ;
}

PHP_FUNCTION( imagick_getxresolution )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */

        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_clear_errors( handle ) ;

        if ( handle->image == ( Image* )NULL )
        {
                RETURN_FALSE ;
        }

        RETURN_LONG( handle->image->x_resolution ) ;
}

PHP_FUNCTION( imagick_getyresolution )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */

        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_clear_errors( handle ) ;

        if ( handle->image == ( Image* )NULL )
        {
                RETURN_FALSE ;
        }

        RETURN_LONG( handle->image->y_resolution ) ;
}

PHP_FUNCTION( imagick_getunits )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */

        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_clear_errors( handle ) ;

        if ( handle->image == ( Image* )NULL )
        {
                RETURN_FALSE ;
        }

        RETURN_LONG( handle->image->units ) ;
}

PHP_FUNCTION( imagick_getcompression )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */

        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_clear_errors( handle ) ;

        if ( handle->image == ( Image* )NULL )
        {
                RETURN_FALSE ;
        }

        RETURN_LONG( handle->image->compression ) ;
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-09 09:06 UTC] senthilnathanns at gmail dot com
Hi,
I used the imagick_setdpi to change the image resolution. But the error arrived like unknown command. I checked this and this function is avail only in the latest version 0.9.12. Where i download this version. Please help me...

Thanks

Senthil Kumar.S
 [2007-04-13 11:48 UTC] scottmac@php.net
We'll no doubt add this in the next major release.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 17:01:30 2024 UTC