BP_GOPP_Image_Editor_GS::set_resolution( int $resolution = null )

Sets the resolution to use for the preview.

Description

Parameters

$resolution

(int) (Optional) Resolution to use for preview.

Default value: null

Return

(true|WP_Error) True if set successful; WP_Error on failure.

Source

File: bp-document/classes/class-bp-gopp-image-editor-gs.php

	public function set_resolution( $resolution = null ) {
		if ( null === $resolution ) {
			/**
			 * Filters the default PDF preview resolution setting.
			 *
			 * Applies only during initial editor instantiation, or when set_resolution() is run
			 * manually without the `$resolution` argument.
			 *
			 * set_resolution() has priority over the filter.
			 *
			 * @since BuddyBoss 1.4.0
			 *
			 * @param int    $resolution Resolution (DPI) of the PDF preview thumbnail.
			 * @param string $filename   The PDF file name.
			 */
			$resolution = apply_filters( 'gopp_editor_set_resolution', $this->default_resolution, $this->file );
			if ( ( $resolution = intval( $resolution ) ) <= 0 ) {
				$resolution = $this->default_resolution;
			}
		} else {
			$resolution = intval( $resolution );
		}
		if ( $resolution > 0 ) {
			$this->resolution = $resolution;
			return true;
		}
		return new WP_Error( 'invalid_image_resolution', __( 'Attempted to set PDF preview resolution to an invalid value.', 'buddyboss' ) );
	}

Changelog

Changelog
Version Description
BuddyBoss 1.4.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.