PHP code example of indy2kro / php-iso
1. Go to this page and download the library: Download indy2kro/php-iso library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
indy2kro / php-iso example snippets
use PhpIso\IsoFile;
use PhpIso\Descriptor\Type;
use PhpIso\Descriptor\PrimaryVolume;
use PhpIso\FileDirectory;
use PhpIso\PathTableRecord;
$isoFilePath = 'test.iso';
$isoFile = new IsoFile($isoFilePath);
// you can process each descriptor using $isoFile->descriptors directly
/** @var PrimaryVolume $primaryVolumeDescriptor */
$primaryVolumeDescriptor = $isoFile->descriptors[Type::PRIMARY_VOLUME_DESC];
// get the path table
$pathTable = $primaryVolumeDescriptor->loadTable($isoFile);
$paths = [];
/** @var PathTableRecord $pathRecord */
foreach ($pathTable as $pathRecord) {
$currentPath = $pathRecord->getFullPath($pathTable);
$paths[$currentPath] = [];
// check extents
$extents = $pathRecord->loadExtents($isoFile, $primaryVolumeDescriptor->blockSize);
if ($extents !== false) {
/** @var FileDirectory $extentRecord */
foreach ($extents as $extentRecord) {
$path = $extentRecord->fileId;
if ($extentRecord->isDirectory()) {
$path .= '/';
}
$paths[$currentPath][] = $path;
}
}
}
print_r($paths);