public static function normalize_filename($input) {
		if (empty($input)) {
			return false;
		}

		$pathinfo = pathinfo($input);

		// Normalize extension.
		$ext = mb_strtolower($pathinfo['extension']);
		if ($ext === 'jpeg') {
			$ext = 'jpg';
		}

		// Rebuild filename.
		$filename = $pathinfo['filename'].'.'.$ext;

		// Sanitize.
		$filename = static::sanitize_filename($filename);

		return $filename;
	}
public static function normalize_filename($input) {
		if (empty($input)) {
			return false;
		}

		$pathinfo = pathinfo($input);

		// Normalize extension.
		$ext = mb_strtolower($pathinfo['extension']);
		if ($ext === 'jpeg') {
			$ext = 'jpg';
		}

		// Rebuild filename.
		$filename = $pathinfo['filename'].'.'.$ext;

		// Sanitize.
		$filename = static::sanitize_filename($filename);

		return $filename;
	}
public static function normalize_filename ( $ input ) { if ( empty ( $ input ) ) { return false ; } $ pathinfo = pathinfo ( $ input ) ; // Normalize extension. $ ext = mb_strtolower ( $ pathinfo [ 'extension' ] ) ; if ( $ ext === 'jpeg' ) { $ ext = 'jpg' ; } // Rebuild filename. $ filename = $ pathinfo [ 'filename' ] . '.' . $ ext ; // Sanitize. $ filename = static :: sanitize_filename ( $ filename ) ; return $ filename ; }
This helps us create normalized filenames.

As the point of this function is to alter the input, the result should not be used to refer to the original, but instead
used as a normalized name for storing new files.

@param string $input The input filename.
@return string Normalized filename.
This helps us create normalized filenames .