cvs: /php4/ext/pdf pdf.c php_pdf.h

From: Date: Thu, 10 Feb 2000 10:21:00 +0000
Subject: cvs: /php4/ext/pdf pdf.c php_pdf.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-10014@lists.php.net to get a copy of this message
steinm Thu Feb 10 02:21:00 2000 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - added pdf_open_tiff() Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.21 php4/ext/pdf/pdf.c:1.22 --- php4/ext/pdf/pdf.c:1.21 Wed Feb 2 03:18:01 2000 +++ php4/ext/pdf/pdf.c Thu Feb 10 02:20:29 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pdf.c,v 1.21 2000/02/02 11:18:01 steinm Exp $ */ +/* $Id: pdf.c,v 1.22 2000/02/10 10:20:29 steinm Exp $ */ /* pdflib 2.01 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ @@ -141,6 +141,7 @@ PHP_FE(pdf_set_transition, NULL) PHP_FE(pdf_set_duration, NULL) PHP_FE(pdf_open_jpeg, NULL) + PHP_FE(pdf_open_tiff, NULL) #if HAVE_LIBGD13 PHP_FE(pdf_open_memory_image, NULL) #endif @@ -2135,6 +2136,40 @@ } pdf_image = PDF_open_JPEG(pdf, arg2->value.str.val); + + if(pdf_image < 0) { + php_error(E_WARNING, "Could not open image"); + RETURN_FALSE; + } + + id = zend_list_insert((void *) pdf_image,PDF_GLOBAL(le_pdf_image)); + RETURN_LONG(id); +} +/* }}} */ + +/* {{{ proto int pdf_open_tiff(int pdf, string tifffile) + Opens a tiff file and returns an image for placement in a pdf document */ +PHP_FUNCTION(pdf_open_tiff) { + pval *arg1, *arg2; + int id, type; + int pdf_image; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + convert_to_string(arg2); + id=arg1->value.lval; + pdf = zend_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + pdf_image = PDF_open_TIFF(pdf, arg2->value.str.val); if(pdf_image < 0) { php_error(E_WARNING, "Could not open image"); Index: php4/ext/pdf/php_pdf.h diff -u php4/ext/pdf/php_pdf.h:1.2 php4/ext/pdf/php_pdf.h:1.3 --- php4/ext/pdf/php_pdf.h:1.2 Fri Dec 17 12:55:17 1999 +++ php4/ext/pdf/php_pdf.h Thu Feb 10 02:20:29 2000 @@ -26,7 +26,7 @@ | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ -/* $Id: php_pdf.h,v 1.2 1999/12/17 20:55:17 zeev Exp $ */ +/* $Id: php_pdf.h,v 1.3 2000/02/10 10:20:29 steinm Exp $ */ #ifndef _PHP_PDF_H #define _PHP_PDF_H @@ -103,6 +103,7 @@ PHP_FUNCTION(pdf_set_transition); PHP_FUNCTION(pdf_set_duration); PHP_FUNCTION(pdf_open_jpeg); +PHP_FUNCTION(pdf_open_tiff); #if HAVE_LIBGD13 PHP_FUNCTION(pdf_open_memory_image); #endif

« previous php.version4 (#10014) next »