Prevent invalid offset warning

This commit is contained in:
Tetrakern 2023-01-26 09:54:27 +01:00
parent d8d2e525cc
commit 5dd94d8138

View File

@ -388,7 +388,7 @@ if ( ! function_exists( 'fictioneer_add_epub_chapters' ) ) {
// Prepare path (remove unwanted extensions, e.g. '.jpg?_i=AA')
$path_parts = pathinfo( $url );
$extension = preg_replace( '/(?<=\.jpg|jpeg|png|gif|webp|svg|avif|apng).+/', '', '.' . $path_parts['extension'] );
$extension = preg_replace( '/(?<=\.jpg|jpeg|png|gif|webp|svg|avif|apng).+/', '', '.' . $path_parts['extension'] ?? 'jpg' );
// Copy image to ePUb directory
copy( $url, $epub_dir . '/OEBPS/Images/' . $path_parts['filename'] . $extension );