';
$thumbnail = '';
$file_name = '';
$file_type = '';
/* container for the image preview (or file ico) and name and file type */
if( !empty ( $value ) ){
$file_src = wp_get_attachment_url($value);
$thumbnail = wp_get_attachment_image( $value, array( 80, 60 ), true );
$file_name = get_the_title( $value );
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $value ), $matches ) )
$file_type = esc_html( strtoupper( $matches[1] ) );
else
$file_type = strtoupper( str_replace( 'image/', '', get_post_mime_type( $value ) ) );
}
$element .= '
'. $thumbnail .'
'. $file_name .''. $file_type . '';
if( !empty ( $value ) )
$element .= ''.__( 'Remove', 'wck' ).'';
$element .= '
';
/* the upload link. we send through get the hidden input id, details div id and meta name */
if( !empty( $details['attach_to_post'] ) ){
$attach_to_post = 'post_id='. $post_id .'&';
}else {
$attach_to_post = '';
}
if( empty( $var_prefix ) )
$var_prefix = '';
if( empty( $edit_class ) )
$edit_class = '';
$media_upload_url = 'media-upload.php?'.$attach_to_post.'type=file&mb_type='. $var_prefix . esc_js(strtolower( $upload_input_id ) ).'&mb_info_div='.$var_prefix . esc_js(strtolower( $upload_info_div_id ) ).'&meta_name='.$meta.'&TB_iframe=1';
$media_upload_url = admin_url( $media_upload_url );
$element .= ''. __( 'Upload ', 'wck' ) . $details['title'] .' ';
/* add js global var for the hidden input, and info container div */
$element .= '';
?>