note 71246 deleted from ref.id3 by danbrown

From: Date: Sun, 20 Jul 2008 01:41:32 +0000
Subject: note 71246 deleted from ref.id3 by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141912@lists.php.net to get a copy of this message
Note Submitter: jbwalker at telus dot net ---- Oops! The code below was inelegant to begin with and stripped down further to limit space taken up here, contains one serious bug: the assumption that the input tag header (first 10 bytes) will do for output. This likely works fine if your own finely tuned tags take up less real estate than MS's bloated headers but not if you read mp3s from a product that sets a tag length less than the length of your own header! A simple fix for this is to insert the code: $tagLen = 1024; # or whatever you like >your actual $Header = substr($Header,0,6).setHexTagLen($tagLen); after the line '$music = etc. The setHexTagLen can be figured out from the calcDecTagLen but here's some sample code. function setHexTagLen($int) { $n = pow(128,3); $intVar = $int; $m = ""; for ($i=0;$i<4;$i++) { $m .= chr(floor($intVar/$n)); $intVar = $intVar % $n; $n=$n/128; } return $m; }

« previous php.notes (#141912) next »