note 94898 added to function.fseek
| From: | MaxChristianPohle at osu1 dot php dot net | Date: | Tue, 01 Dec 2009 18:12:17 +0000 |
| Subject: | note 94898 added to function.fseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163462@lists.php.net to get a copy of this message | ||
This example demonstrates, how fseek can be used to determine the dimension (size) of an
mp4-video-file:
<?php
$fh; # filehandle
if(($fh = fopen($filename, "rb")) === FALSE)
{ die("unable to open file '$filename'!"); }
# seek headerposition, where sizeX is...
fseek($fh, 0xE8);
$sizeX = fread($fh, 2); # read two bytes (the width)
# seek headerposition, where sizeY is...
fseek($fh, 0xEC);
$sizeY = fread($fh, 2); # read two bytes (the height)
fclose($fh);
echo "sizeX: ".hexdec(bin2hex($sizeX))."<br/>";
echo "sizeX: ".hexdec(bin2hex($sizeY))."<br/>";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 212.100.46.73
----
Manual Page -- http://www.php.net/manual/en/function.fseek.php
Edit -- https://master.php.net/note/edit/94898
Del: integrated -- https://master.php.net/note/delete/94898/integrated
Del: useless -- https://master.php.net/note/delete/94898/useless
Del: bad code -- https://master.php.net/note/delete/94898/bad+code
Del: spam -- https://master.php.net/note/delete/94898/spam
Del: non-english -- https://master.php.net/note/delete/94898/non-english
Del: in docs -- https://master.php.net/note/delete/94898/in+docs
Del: other reasons-- https://master.php.net/note/delete/94898
Reject -- https://master.php.net/note/reject/94898
Search -- https://master.php.net/manage/user-notes.php