wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



_wp_get_client_side_media_image_settings › WordPress Function

Seit7.2.0
Veraltetn/v
› _wp_get_client_side_media_image_settings ( Keine Parameter )
Zugriff:
  • private
Gibt zurück:
  • (array<string,mixed>) Image processing settings.
Definiert in:
Codex:

Returns the image processing settings for client-side media processing.

Shared by the REST API index, which the block editor reads, and wp_get_media_library_upload_settings(), so both pipelines apply the same filters.


Quellcode

function _wp_get_client_side_media_image_settings(): array {
	/** This filter is documented in wp-admin/includes/image.php */
	$image_size_threshold = max( 0, (int) apply_filters( 'big_image_size_threshold', 2560, array( 0, 0 ), '', 0 ) );

	/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
	$image_strip_meta = (bool) apply_filters( 'image_strip_meta', true );

	/*
	 * On the server, this filter receives the decoded image's actual bit depth.
	 * The client path never decodes the image on the server, so the filter is
	 * applied with 16 (the maximum depth the client encoder can produce) as
	 * both the value and the current depth. The client caps its output bit
	 * depth at the filtered value, so a plugin lowering it (e.g. to 8) takes
	 * effect on client-generated images too.
	 */
	/** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
	$image_max_bit_depth = max( 0, (int) apply_filters( 'image_max_bit_depth', 16, 16 ) );

	/**
	 * Filters whether client-side media processing preserves animation in image sub-sizes.
	 *
	 * By default, sub-sizes of animated GIF and WebP images retain animation,
	 * including cropped sizes. Return false to generate static sub-sizes using
	 * only the first frame, reducing processing time in the browser.
	 *
	 * This setting applies only to client-side media processing. Server-side
	 * processing continues to generate static sub-sizes.
	 *
	 * @since 7.2.0
	 *
	 * @param bool $generate_animated_image_subsizes Whether to preserve animation in image sub-sizes.
	 *                                               Default true.
	 */
	$generate_animated_image_subsizes = (bool) apply_filters( 'wp_generate_animated_image_subsizes', true );

	return array(
		'image_sizes'                      => wp_get_registered_image_subsizes(),
		'image_size_threshold'             => $image_size_threshold,
		'image_strip_meta'                 => $image_strip_meta,
		'image_max_bit_depth'              => $image_max_bit_depth,
		'generate_animated_image_subsizes' => $generate_animated_image_subsizes,
	);
}