load() public method

The data given will be parsed and an internal tree representation will be built. If the data cannot be parsed correctly, a {@link PelInvalidDataException} is thrown, explaining the problem.
public load ( lsolesen\pel\PelDataWindow $d )
$d lsolesen\pel\PelDataWindow
Beispiel #1
0
    exit(1);
}
if (!is_readable($file)) {
    printf("Unable to read %s!\n", $file);
    exit(1);
}
/*
 * We typically need lots of RAM to parse TIFF images since they tend
 * to be big and uncompressed.
 */
ini_set('memory_limit', '32M');
$data = new PelDataWindow(file_get_contents($file));
if (PelJpeg::isValid($data)) {
    $img = new PelJpeg();
} elseif (PelTiff::isValid($data)) {
    $img = new PelTiff();
} else {
    print "Unrecognized image format! The first 16 bytes follow:\n";
    PelConvert::bytesToDump($data->getBytes(0, 16));
    exit(1);
}
/* Try loading the data. */
$img->load($data);
print $img;
/* Deal with any exceptions: */
if (count(Pel::getExceptions()) > 0) {
    print "\nThe following errors were encountered while loading the image:\n";
    foreach (Pel::getExceptions() as $e) {
        print "\n" . $e->__toString();
    }
}