wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_get_image_suffix › WordPress Function

Since6.1.0
Deprecatedn/a
_wp_get_image_suffix ( $resized, $rotated )
Access:
  • private
Parameters: (2)
  • (bool|WP_Error) $ Whether the image was resized, or an error if resizing failed.
    Required: Yes
  • (bool|WP_Error) $ Whether the image was rotated, or an error if rotating failed.
    Required: Yes
Returns:
  • (string) The suffix to use for the file name, or empty string if none.
Defined at:
Codex:

Gets the suffix to use for image files based on resizing and rotating.



Source

function _wp_get_image_suffix( $resized, $rotated ) {
	if ( $resized && ! is_wp_error( $resized ) ) {
		// Append "-scaled" to the image file name. It will look like "my_image-scaled.jpg".
		// This doesn't affect the sub-sizes names as they are generated from the original image (for best quality).
		return 'scaled';
	}

	if ( true === $rotated ) {
		// Append `-rotated` to the image file name.
		return 'rotated';
	}

	if ( is_wp_error( $resized ) || is_wp_error( $rotated ) ) {
		// TODO: Log errors.
	}
	return '';
}