note 44572 added to function.pdf-open-image

From: Date: Tue, 10 Aug 2004 02:46:01 +0000
Subject: note 44572 added to function.pdf-open-image
Groups: php.notes 
Request: Send a blank email to php-notes+get-74370@lists.php.net to get a copy of this message
Unlike fopen(), the PDF library does NOT allow one to search for a file along the include path. Where I work, the images used for document generation are kept in an include path, which is fine for some applications, but PDFLib requires an absolute path. This small function will take a relative path to a file and search the include structure, eventually returning either the absolute path or false. <?php function get_absolute( $file ) { $include_path = ini_get( 'include_path' ); $a_paths = split( ':', $include_path ); foreach( $a_paths as $path ) { if ( is_file( $path . '/' . $file ) ) { return $path . '/' . $file; } } return false; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.pdf-open-image.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44572 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44572&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44572&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#74370) next »