note 71246 added to ref.id3

From: Date: Sat, 18 Nov 2006 23:37:47 +0000
Subject: note 71246 added to ref.id3
Groups: php.notes 
Request: Send a blank email to php-notes+get-119860@lists.php.net to get a copy of this message
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; } ---- Server IP: 66.207.199.35 Probable Submitter: 207.81.127.107 ---- Manual Page -- http://www.php.net/manual/en/ref.id3.php Edit -- https://master.php.net/note/edit/71246 Del: integrated -- https://master.php.net/note/delete/71246/integrated Del: useless -- https://master.php.net/note/delete/71246/useless Del: bad code -- https://master.php.net/note/delete/71246/bad+code Del: spam -- https://master.php.net/note/delete/71246/spam Del: non-english -- https://master.php.net/note/delete/71246/non-english Del: in docs -- https://master.php.net/note/delete/71246/in+docs Del: other reasons-- https://master.php.net/note/delete/71246 Reject -- https://master.php.net/note/reject/71246 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119860) next »