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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

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-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 23:01:24 2020 UTC