"Andre M. Winter - Carto.net" <[EMAIL PROTECTED]> writes: Hi Andre
> when allowing users to edit EXIF data thanks to PEL, it happens that
> data is wrong and that some fields should be dropped. it seems to
> work well with ASCII and RATIONAL files to do $val->setValue(null),
Well, that's more a bug than a feature! :-)
> but with the timestamp, whatever i set it to, if it is not valid, it
> returns "1970-01-01 01:00:00". as this is a valid timestamp, one
> cannot use it as a placeholder for empty data.
No, the argument is forced to be an integer and thus your null is
converted into 0.
> more generally, is there a method for totally erasing a PelEntry, a
> PelIfd or a Section?
Hmm... good question! I just looked at the code and at first I
thought that there were no way to modify a PelIfd like you want!
But then I found the (unfortunately undocumented) offsetExists(),
offsetUnset(), etc. methods --- and after scratching my head a bit I
remembered why I put them there: to make PelIfd implement the
ArrayAccess interface!
So you should be able to treat a PelIfd object exactly like an array
(but the indices are PelTag values instead of simply 0..n):
$ifd = ...
$ifd[PelTag::Y_RESOLUTION] = ...
unset($ifd[PelTag::FNUMBER])
foreach ($ifd as $tag => $entry) {
// $tag is now a PelTag and $entry is a PelEntry object.
}
This functionality has of course not been tested much since it's very
PHP5 specific and thus not expected by most PHP coders -- myself
included :-) -- so please report your experiences back.
--
Martin Geisler GnuPG Key: 0x7E45DD38
PHP Exif Library | PHP Weather | PHP Shell
http://pel.sf.net/ | http://phpweather.net/ | http://mgeisler.net/
Read/write Exif data | Show current weather | A shell in a browser
pgpoU7BbDBFwR.pgp
Description: PGP signature
