protected function InterlaceTest::isPngInterlaced in Image Effects 8.3
Same name and namespace in other branches
- 8 tests/src/Functional/Effect/InterlaceTest.php \Drupal\Tests\image_effects\Functional\Effect\InterlaceTest::isPngInterlaced()
- 8.2 tests/src/Functional/Effect/InterlaceTest.php \Drupal\Tests\image_effects\Functional\Effect\InterlaceTest::isPngInterlaced()
Checks if this is an interlaced PNG.
Parameters
\Drupal\Core\Image\ImageInterface $image: An image object that need to be checked.
Return value
bool Returns TRUE on success or FALSE on failure.
See also
http://stackoverflow.com/questions/14235600/php-test-if-image-is-interlaced
1 call to InterlaceTest::isPngInterlaced()
- InterlaceTest::testInterlaceEffect in tests/
src/ Functional/ Effect/ InterlaceTest.php - Interlace effect test.
File
- tests/
src/ Functional/ Effect/ InterlaceTest.php, line 83
Class
- InterlaceTest
- Interlace effect test.
Namespace
Drupal\Tests\image_effects\Functional\EffectCode
protected function isPngInterlaced(ImageInterface $image) {
$source = $image
->getSource();
$real_path = $this->container
->get('file_system')
->realpath($source);
$handle = fopen($real_path, "r");
$contents = fread($handle, 32);
fclose($handle);
return ord($contents[28]) != 0;
}