Reading PDF meta

From: Date: Tue, 27 Dec 2005 15:36:25 +0000
Subject: Reading PDF meta
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-40838@lists.php.net to get a copy of this message
Hi, ok, I think using only libextractor wouldn’t be a really good solution, simply because libextractor may not be available on many systems. So here’s a small concept for a “File_Meta” class (would this be the right name?).. Success criteria: - Must be able to read meta data from different file formats. There must be no differences in api. - Should use only PHP code if possible and check if libextractor is installed on server as a fallback if no “driver” is available. - Handlers for file formats must be implemented as single files called “drivers”. There’s no driver specific source code in main class. - Class is intended for reading, but it should be possible to extend the class with write functions at a later date without modifications to the api of the “read” functions. - Must run on PHP >= 5.0 Here’s first draft of a class that could do this… Directory layout: /File/Meta.php (main class) /File/Meta/Driver.php (abstract driver class. Drivers extend this base class) /File/Meta/Data.php (result) /File/Meta/Drivers/image/jpeg.php (folder “Drivers” has one file per file/class per file format, file name = name of mime type) API Class File_Meta Properties - useLibextractor:bool (default true) - useOnlyLibextractor:bool (default false) Methods - readMeta(filename:string, mime_type:string):File_Meta_Data - writeMeta(filename:string, mime_type:string, data:File_Meta_Data object) (to be added later) - isSupported(mime_type:string):Boolean Class File_Meta_Driver Properties - mimeType:string - filename:string - supportsReadAccess:bool - supportsWriteAccess:bool Methods - read():mixed (File_Meta_Data or PEAR_Error) - write():mixed (true on success or PEAR_Error) class File_Meta_Data implements Interator, ArrayAccess Would be nice to get some feedback ;-) Chris

« previous php.pear.dev (#40838) next »