Changeset 3086 for libpipi/trunk


Ignore:
Timestamp:
Oct 24, 2008, 3:49:02 PM (12 years ago)
Author:
nico
Message:

Add php binding for pipi_command
Add a php rewrite of pipi.c in examples/

Location:
libpipi/trunk/pipi-php
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi-php/examples/histogram.php

    r3080 r3086  
    66$histogram = pipi_new_histogram();
    77$histogram_img = pipi_new(320, 200);
    8 echo pipi_get_image_histogram($img, $histogram, 1);
    9 echo pipi_render_histogram($img_histogram, $histogram, 1);
     8pipi_get_image_histogram($img, $histogram, 1);
     9pipi_render_histogram($img_histogram, $histogram, 1);
    1010
    1111pipi_save($histogram_img, "out.png");
  • libpipi/trunk/pipi-php/php_pipi.c

    r3080 r3086  
    203203
    204204PHP_FUNCTION(pipi_command) {
     205        zval *res;
     206        char *arg1, *arg2 = NULL;
     207        int arg1_len, arg2_len;
     208        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|s", &res, &arg1, &arg1_len, &arg2, &arg2_len) == FAILURE) {
     209                RETURN_FALSE;
     210        }
     211
     212        pipi_context_t *ctxt;
     213        ZEND_FETCH_RESOURCE(ctxt, pipi_context_t*, &res, -1, PHP_PIPI_CONTEXT_RES_NAME, le_pipi_context);
     214
     215        if (arg2_len != 0) {
     216                RETURN_LONG(pipi_command(ctxt, arg1, arg2));
     217        }
     218        RETURN_LONG(pipi_command(ctxt, arg1)); 
    205219}
    206220
Note: See TracChangeset for help on using the changeset viewer.