Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

[0.9.10] PelIllegalFormatException: Unknown format: 0x0 #183

Open
Commifreak opened this issue Feb 11, 2021 · 11 comments
Open

[0.9.10] PelIllegalFormatException: Unknown format: 0x0 #183

Commifreak opened this issue Feb 11, 2021 · 11 comments

Comments

@Commifreak
Copy link

We recenty upgraded to PHP 7.4 with PEL 0.9.10. Since then, we have the following error after the first EXIF write:

                lsolesen\pel\PelIllegalFormatException: Unknown format: 0x0 in /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelFormat.php:224
Stack trace:
#0 /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelIfd.php(723): lsolesen\pel\PelFormat::getSize()
#1 /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelIfd.php(649): lsolesen\pel\PelIfd->loadSingleValue()
#2 /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelTiff.php(159): lsolesen\pel\PelIfd->load()
#3 /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelExif.php(100): lsolesen\pel\PelTiff->load()
#4 /var/www/dev.deutsche-genbank-obst.de/vendor/lsolesen/pel/src/PelJpeg.php(216): lsolesen\pel\PelExif->load()
#5 /var/www/dev.deutsche-genbank-obst.de/controllers/PassportController.php(426): lsolesen\pel\PelJpeg->load()

The first write of exif is successful. The second (open already edited file) does not load anymore.

Downgrading to 0.9.9 works.

@Commifreak Commifreak changed the title PelIllegalFormatException: Unknown format: 0x0 [0.9.10] PelIllegalFormatException: Unknown format: 0x0 Feb 11, 2021
@agaktr
Copy link

agaktr commented Apr 6, 2021

anything here anyone?

@agaktr
Copy link

agaktr commented Apr 6, 2021

Found a potential fix or at least a round over the issue.
pel\src\PelFormat.php

PelFormat.zip

@DeveloperMarius
Copy link

Seems to be related to #174.

@ovidiul
Copy link

ovidiul commented Dec 14, 2021

Similar problem with the latest version 0.9.10, I am using the following code to remove GPS data as:

<?php

require_once './vendor/autoload.php';

use lsolesen\pel\PelJpeg;
use lsolesen\pel\PelIfd;

$filename = 'test.jpg';

$jpeg = new PelJpeg( $filename );
$exif = $jpeg->getExif();
$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd();

// removing GPS data by adding a new empty PelIfd::GPS IFD.
$gps = $ifd0->addSubIfd( new PelIfd( PelIfd::GPS ) );

// saving the new file.
$jpeg->saveFile( 'new-' . $filename );

but opening the new-test.jpg generated file shows this error:

lsolesen\pel\PelIllegalFormatException: Unknown format: 0x0 in /.../vendor/lsolesen/pel/src/PelFormat.php on line 224

@ViktorasssIT
Copy link

Similar problem with the latest version 0.9.10, I am using the following code to remove GPS data as:

<?php

require_once './vendor/autoload.php';

use lsolesen\pel\PelJpeg;
use lsolesen\pel\PelIfd;

$filename = 'test.jpg';

$jpeg = new PelJpeg( $filename );
$exif = $jpeg->getExif();
$tiff = $exif->getTiff();
$ifd0 = $tiff->getIfd();

// removing GPS data by adding a new empty PelIfd::GPS IFD.
$gps = $ifd0->addSubIfd( new PelIfd( PelIfd::GPS ) );

// saving the new file.
$jpeg->saveFile( 'new-' . $filename );

but opening the new-test.jpg generated file shows this error:

lsolesen\pel\PelIllegalFormatException: Unknown format: 0x0 in /.../vendor/lsolesen/pel/src/PelFormat.php on line 224

Did you found a fix to this issue? Having the same problem now.

@Rar9
Copy link

Rar9 commented Jan 7, 2022

Any hope to get this fixed any time soon?

@ViktorasssIT
Copy link

Any hope to get this fixed any time soon?

Downgraded to 0.9.9 and it fixed the issue.

@Rar9
Copy link

Rar9 commented Jan 9, 2022

Any hope to get this fixed any time soon?

Downgraded to 0.9.9 and it fixed the issue.

Not possible as its used by drupal fdm

@xPaw
Copy link
Contributor

xPaw commented Feb 17, 2022

I have a fix here: #191, unsure if there are other broken cases however.

@weberhofer
Copy link
Collaborator

Please test with latest release 0.9.12

@StavoveiC
Copy link

I tested with release 0.9.12 but the issue is still present. Then I tried the fix from #183 (comment) and it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants