WP HOOKS
filtrod 2.5.0

jpeg_quality

Args 2Plik wp-includes/class-wp-image-editor.phpDokumentacja WP ↗

Opis

Ustawia jakość kompresji obrazów JPEG generowanych przez WordPress.

Przykład użycia

add_filter( 'jpeg_quality', ... )php
add_filter( 'jpeg_quality', 'wpdocs_jpeg_quality' );

function wpdocs_jpeg_quality( $quality ) {
	return 82;
}

Applies only during initial editor instantiation, or when set_quality() is run manually without the $quality argument. The WP_Image_Editor::set_quality() method has priority over the filter. The filter is evaluated under two contexts: 'image_resize', and 'edit_image', (when a JPEG image is saved to file).

Parametry

ParametrTypOpis
$qualityintQuality level between 0 (low) and 100 (high) of the JPEG.
$contextstringContext of the filter.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'jpeg_quality', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii