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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael at elfimov dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Dec 26 14:01:30 2024 UTC