BP_GOPP_Image_Editor_GS::get_gs_args( string $filename )

Returns the arguments for the main Ghostscript invocation.

Description

Parameters

$filename

(string) (Required) File name of output JPEG.

Return

(string) Arguments string, shell-escaped.

Source

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

	protected function get_gs_args( $filename ) {
		$ret = $this->initial_gs_args();

		if ( ( $quality = intval( $this->get_quality() ) ) > 0 && $quality <= 100 ) {
			$ret .= ' -dJPEGQ=' . $quality; // Nothing escape-worthy.
		}
		if ( ( $resolution = intval( $this->get_resolution() ) ) > 0 ) {
			$ret .= ' -r' . $resolution; // Nothing escape-worthy.
		}

		if ( ( $page = intval( $this->get_page() ) ) > 0 ) {
			$ret .= " -dFirstPage=$page -dLastPage=$page"; // Nothing escape-worthy.
		} else {
			$ret .= ' -dFirstPage=1 -dLastPage=1';
		}

		$ret .= ' ' . self::escapeshellarg( '-sOutputFile=' . $filename );
		if ( self::is_win() ) {
			$ret .= ' -sstdout=NUL'; // Lessen noise.
		} else {
			$ret .= ' -sstdout=/dev/null'; // Lessen noise.
		}
		$ret .= ' --'; // No more options.
		$ret .= ' ' . self::escapeshellarg( $this->file );

		return $ret;
	}

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.