BP_GOPP_Image_Editor_GS::get_size()

Gets dimensions of image.

Description

Return

(array) 'width'=>int, 'height'=>int

Source

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

	public function get_size() {
		// If size hasn't been set yet and have loaded.
		if ( null === $this->size && $this->mime_type ) {
			$this->update_size( 0, 0 );
			// Do a temporary full preview to get size of image.
			$dirname  = untrailingslashit( get_temp_dir() );
			$filename = $dirname . '/' . wp_unique_filename( $dirname, 'gopp_size.jpg' );
			if ( $cmd = self::gs_cmd( $this->get_gs_args( $filename ) ) ) {
				$return_var = -1;
				$output     = array();
				exec( $cmd, $output, $return_var );
				if ( 0 === $return_var && ( $size = @ getimagesize( $filename ) ) ) {
					$this->update_size( $size[0], $size[1] );
				}
				@ unlink( $filename );
			}
		}
		return $this->size;
	}

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.