BP_Media_Rotation::rotation_shutdown_fallback()

Attempt to capture a failed image rotation due to memory exhaustion

Description

Source

File: bp-media/classes/class-bp-media-rotation.php

		function rotation_shutdown_fallback() {
			global $bp_media_rotation_fix_id;

			$error = error_get_last();

			// Make sure an error was thrown from this file
			if ( empty( $error ) || empty( $error['file'] ) || (int) $error['type'] !== 1
			     || $error['file'] !== __FILE__ ) {
				return;
			}

			@header( "HTTP/1.1 200 OK" );

			$aid        = $bp_media_rotation_fix_id;
			$attachment = get_post( $aid );
			$name       = $url = null;

			if ( $attachment !== null ) {
				$name     = $attachment->post_title;
				$url_nfo  = wp_get_attachment_image_src( $aid );
				$url      = is_array( $url_nfo ) && ! empty( $url_nfo ) ? $url_nfo[0] : null;
			}

			$result = array(
				'status'        => ( $attachment !== null ),
				'attachment_id' => (int) $aid,
				'url'           => esc_url( $url ),
				'name'          => esc_attr( $name )
			);

			echo htmlspecialchars( json_encode( $result ), ENT_NOQUOTES );
			exit( 0 );
		}

Changelog

Changelog
Version Description
BuddyBoss 1.1.1 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.