{ return $vc_image; } $image = image_get_intermediate_size( $attachment_id, array( $size[1], $size[2] ) ); if ( $image ) { return $vc_image; } // Smush image. TODO: should we update the stats? WP_Smush::get_instance()->core()->mod->smush->do_smushit( $vc_image ); return $vc_image; } /** * Replace the image src with cdn link for all the Ajax requests. * * @since 3.9.10 * * @see SMUSH-206 * * @param array|false $image { * Array of image data, or boolean false if no image is available. * * @type string $0 Image source URL. * @type int $1 Image width in pixels. * @type int $2 Image height in pixels. * @type bool $3 Whether the image is a resized image. * } * * @return mixed */ public function cdn_attachment_image_src( $image ) { if ( ! wp_doing_ajax() ) { return $image; } $cdn = WP_Smush::get_instance()->core()->mod->cdn; if ( ! $cdn->get_status() ) { return $image; } if ( is_array( $image ) && ! empty( $image[0] ) ) { $image[0] = $cdn->generate_cdn_url( $image[0] ); } return $image; } /************************************** * * PRIVATE CLASSES */ /** * Should only be active when WPBakery Page Builder is installed. * * @since 3.2.1 * * @see https://kb.wpbakery.com/docs/inner-api/vc_disable_frontend */ private function check_for_js_builder() { // This function exists since WPBakery 4.0 (02.03.2014) and is listed // on their API docs. It should be stable enough to rely on it. $this->enabled = defined( 'WPB_VC_VERSION' ) && function_exists( 'vc_disable_frontend' ); } }