getIfd() public method

Return the first IFD.
public getIfd ( ) : PelIfd
return PelIfd the first IFD contained in the TIFF data, if any. If there is no IFD null will be returned.
Beispiel #1
0
 * to be big and uncompressed.
 */
ini_set('memory_limit', '32M');
foreach ($argv as $file) {
    println('Reading file "%s".', $file);
    $data = new PelDataWindow(file_get_contents($file));
    if (PelJpeg::isValid($data)) {
        $jpeg = new PelJpeg();
        $jpeg->load($data);
        $app1 = $jpeg->getExif();
        $tiff = $app1->getTiff();
    } elseif (PelTiff::isValid($data)) {
        $tiff = new PelTiff($data);
    } else {
        println('Unrecognized image format! Skipping.');
        continue;
    }
    $ifd0 = $tiff->getIfd();
    $entry = $ifd0->getEntry(PelTag::DATE_TIME);
    if ($entry == null) {
        println('Skipping %s because no DATE_TIME tag was found.', $file);
        continue;
    }
    $time = $entry->getValue();
    do {
        $new = gmdate('Y:m:d-H:i:s', $time) . strchr($file, '.');
        println('Trying file name %s', $new);
        $time++;
    } while (file_exists($new));
    rename($file, $new);
}