try{ if(\is_resource($stream)){ $this->getFileSystem($media)->writeStream($path, $stream); } }finally{ // The Google Cloud Storage filesystem closes the stream even though it should not. To prevent a fatal
// error, we therefore need to check whether the stream has been closed yet.
if(\is_resource($stream)){
return false; } $count = 0;
while(!feof($fh) && $count < 2){ $chunk = fread($fh, 1024 * 100); // read 100kb at a time
if($chunk === false){ if(!Feature::isActive('v6.6.0.0')){ thrownewStreamNotReadableException('Animated gif file not readable'); }
/**
* an animated WebP has an Animation Flag set in the Headers
* (https://developers.google.com/speed/webp/docs/riff_container#extended_file_format)
*
* We check if the file uses the extended file format, which is necessary for animated images
* then we check if the Animation Flag is set
*/