Plugin Updates
This commit is contained in:
@@ -185,6 +185,32 @@ function imagify_path_to_webp( $path ) {
|
||||
return $path . '.webp';
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a path (or URL) to its next-gen version.
|
||||
* To keep the function simple:
|
||||
* - Not tested if it's an image.
|
||||
* - File existance is not tested.
|
||||
* - If an URL is given, make sure it doesn't contain query args.
|
||||
*
|
||||
* @since 2.2
|
||||
*
|
||||
* @param string $path A file path or URL.
|
||||
* @param string $format format we are targeting.
|
||||
* @return string
|
||||
*/
|
||||
function imagify_path_to_nextgen( $path, string $format ) {
|
||||
switch ( $format ) {
|
||||
case 'webp':
|
||||
$path = $path . '.webp';
|
||||
break;
|
||||
case 'avif':
|
||||
$path = $path . '.avif';
|
||||
break;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the current user can optimize custom folders.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user