'full', // The size of the image to use in the generated CSS 'placeholder' => '', // show this when blank ); /** * Constructor * * @return void * @since 1.5 */ function __construct( $settings, $owner ) { parent::__construct( $settings, $owner ); } /* * Display for options and meta */ public function display() { self::createUploaderScript(); $this->echoOptionHeader(); // display the preview image $value = $this->getValue(); if ( is_numeric( $value ) ) { // gives us an array with the first element as the src or false on fail $value = wp_get_attachment_image_src( $value, array( 150, 150 ) ); } if ( ! is_array( $value ) ) { $value = $this->getValue(); } else { $value = $value[0]; } // $value = '101,96'; $value_arr = explode( ',', $value ); foreach ( $value_arr as $k => $v ) { $previewImage = ''; if ( ! empty( $v ) ) { $size = ! empty( $option->settings['size'] ) ? $option->settings['size'] : 'thumbnail'; if ( is_numeric( $v ) ) { $attachment = wp_get_attachment_image_src( $v, $size ); $v = $attachment[0]; } $previewImage = ""; echo "
" . $previewImage . '
'; } } echo "
"; printf('', $this->getID(), $this->settings['placeholder'], $this->getID(), esc_attr( $this->getValue() ) ); $this->echoOptionFooter(); } public static function createUploaderScript() { if ( ! self::$firstLoad ) { return; } self::$firstLoad = false; ?>