Issue #3202016 by mondrake, andypost, acbramley, mstrelan, hestenet, benmorss,...
Issue #3202016 by mondrake, andypost, acbramley, mstrelan, hestenet, benmorss, smustgrave, catch, alexpott, xjm, Mixologic: Let GDToolkit support AVIF image format
@@ -454,6 +462,11 @@ public function getRequirements() {
'@unsupported'=>$unsupported,
'@ref'=>$fix_info,
]);
if(isset($unsupported_formats[IMG_AVIF])){
$descriptions[]=$this->t('AVIF is not supported, likely because of PHP missing a codec for encoding images. See <a href=":cr_url">the change record</a> for more information.',[
':cr_url'=>'https://www.drupal.org/node/3348348',
]);
}
}
// Check for filter and rotate support.
@@ -528,6 +541,31 @@ public function extensionToImageType($extension) {
returnIMAGETYPE_UNKNOWN;
}
/**
* Checks if AVIF can encode image.
*
* This method tries to create an AVIF image and save it to disk via
* imageavif(). If that fails, it's likely a codec missing, or the function
* was disabled. This is an expensive operation to run, so we cache its
* result.
*
* @return bool
* TRUE if AVIF is fully supported, FALSE otherwise.