Skip to content

Commit eda4fc9

Browse files
committed
Fix WebP header generation
1 parent f35cd1f commit eda4fc9

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Image metadata library (PHP 5.5+)
55
> adds the following changes:
66
>
77
> * added `Xmp::getImageRegions()`,
8+
> * fixed WebP header generation,
89
> * unit tests made runnable on PHP8 and newer PHPUnit,
910
> * added linter to validate code against any version of PHP >= 5.5 .
1011
>

src/Format/WebP.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private function getFile($chunks)
274274
$data .= $chunk->getChunk();
275275
}
276276

277-
$header = 'RIFF' . pack('V', strlen($chunks) + 4) . 'WEBP';
277+
$header = 'RIFF' . pack('V', strlen($data) + 4) . 'WEBP';
278278
return $header . $data;
279279
}
280280

tests/Format/WebPTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ public function testConvertsFromSimpleFormat()
9494
$webp = WebP::fromFile(__DIR__ . '/../Fixtures/simple.webp');
9595
$webp->setXmp($xmp);
9696

97-
var_dump($webp->getBytes());
97+
// var_dump($webp->getBytes());
9898
}
9999
}

0 commit comments

Comments
 (0)