BrknPhoenix Posted April 17, 2006 Share Posted April 17, 2006 I need to get the properties of a PCX file, such as color depth, but php doesn't seem to have a lot of support for pcx files. Is there a way to do it? Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted April 17, 2006 Share Posted April 17, 2006 [!--quoteo(post=365505:date=Apr 17 2006, 12:41 PM:name=BrknPhoenix)--][div class=\'quotetop\']QUOTE(BrknPhoenix @ Apr 17 2006, 12:41 PM) [snapback]365505[/snapback][/div][div class=\'quotemain\'][!--quotec--]I need to get the properties of a PCX file, such as color depth, but php doesn't seem to have a lot of support for pcx files. Is there a way to do it?[/quote]if all you're after is the info of the file, then fopen/fread functions can be used to construct something to read the header of a PCX file. a quick google search for 'pcx file format' gave me this:[a href=\"http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-pcx.html\" target=\"_blank\"]http://courses.ece.uiuc.edu/ece390/books/l...aphics-pcx.html[/a] which although has nothing to do with PHP, it'll show you what each bit of info you retrieve with 'fread' means. taking a guess from that link, , it looks like the colordepth is 3 bytes in. so:[code]$file = f open($filename, 'r');f seek($file, 3);$depth = f read($file, 1);f close($file);echo 'depth is '.$depth;[/code][b]note:[/b] i've added a space in the fopen/fseek/fread/fclose functions in my example as it wasn't letting me post my reply. obviously just remove these first.if that works, it'd be easy enough to get the other info from the file you need.cheersMark Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.