shopp_image_scale

filters the ImageProcessor object returned after the image scale operation.

add_filter( 'shopp_image_scale', [callback] )

@param ImageProcessor $IP the ImageProcessor object returned after the image scale operation.

Description

filters the ImageProcessor object returned after the image scale operation.

Example

// register filter callback
add_filter('shopp_image_scale', 'shopp_image_scale_filter');

// create filter function
function shopp_image_scale_filter( $IP ) {
    // Set new image parameters
    $IP->dx = 0;
    $IP->dy = 0;
    $IP->width = 100;
    $IP->height = 100;

    // Resample the image
    ImageCopyResampled(
        $IP->processed,   // image link resource for dest image
        $IP->src->image,  // image link resource for src image
        $IP->dx, $IP->dy, // dest_x, dest_y
        0, 0,         // src_x, src_y
        $IP->width, $IP->height, // dest_width, dest_height
        $IP->src->width, $IP->src->height // src_width, src_height
    );
    $IP->width = imagesx($IP->processed);
    $IP->height = imagesy($IP->processed);

    return $IP;
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar