WordPress.org

Ready to get started?Download WordPress

Ideas

Expand the Media Library options

  1. brockangelo
    Member

    12345

    I am seeing this appear a lot in the forums, but not much in "Ideas" and it would really help out those of us who want to integrate WP as a CMS:

    Develop the Media Library into a full-scale document manager. (we can do this in stages) Some ideas:

    --integrate the caption and description of media into search results
    --add fields for tags, meta-data, url, etc.
    --allow sorting the library by date, type, etc.
    --add support for indexing the content of .doc,.pdf,.xls, etc.

    Posted: 5 years ago #
  2. AndreyFrolov
    Member

    12345

    WordPress has a great potential as a full-blown CMS, there is no need to sacrifice it for being "pure blog".

    Posted: 5 years ago #
  3. Ale Urrutia
    Member

    I agree, would be really nice to add these options to the media library, but I must say that on version 2.6 media library is quite good too.

    Posted: 5 years ago #
  4. brockangelo
    Member

    12345

    Don't get me wrong - I love this feature - and I think we are on the right track. I'm just encouraging this route of development.

    I'm using 2.6 as well, but the only options I have for a PDF are Title, Caption & Description. The caption is really cool when you are using it with a JPG, but it doesn't do anything yet for a PDF.

    What seems like the number one priority now would be to optionally integrate the existing Caption & Description into search results. That way you can essentially use these like meta-data or keywords, making searches more relevant for the users.

    Posted: 5 years ago #
  5. skila
    Member

    I am setting up a website now and using the Media Library with lots of different file types.

    For example, I want to insert a "Gallery" of PDF's into my post, so I would expect by hitting "Insert Gallery Into Post", I get a list of links to the documents. I can do this manually, but each page I am editing can have upto 20 files attached to it...

    To expand this, I would like to have plugins that I could apply to the gallery which would work with different file-types - for me this would bring a huge amount of things together - e.g. I could set up a WordPress plugin to use the JW player for FLV file types and register this with the [gallery] system, etc.

    Posted: 5 years ago #
  6. thx2012
    Member

    Skila, where you able to get what you wanted achieved?

    Posted: 5 years ago #
  7. skila
    Member

    thx2012

    Just to list some non-image media quickly, I hacked a quick shortcode handler together which you are welcome to use:

    function media_list_handler($atts, $content = null) {
    
    	$mime_type = "application/pdf";
    
    	if(isset($atts['mime'])) {
    		$mime_type = $atts['mime'];
    	}
    	$attachments = _list_attached_images($mime_type);
    
    	if ( empty($attachments) ) {
    		return $content;
    	}
    
    	if ( is_feed() ) {
    		$output = "\n";
    		foreach ( $attachments as $attachment )
    			$output .= wp_get_attachment_url($attachment->ID). "\n";
    		return $output;
    	}
    
    	$output = "";
    	if($content) {
    		$output = "<h2 class='medialistcaption'>" .$content ."</h2>\n";
    	}
    	$output .= "<ul class='medialist'>\n";
    	$count = count($attachments);
    	$i = 0;
    
    	//$to_preload;
    	foreach( $attachments as $attachment ) {
    
    		$i++;
    		$title = isset( $attachment->post_title ) ? $attachment->post_title : "Item " .$i;
    
    		$output .= "<li><a href='" .wp_get_attachment_url($attachment->ID) ."' title='" .$title ."'>";
    		$output .= $title ."</a></li>\n";
    
    	}
    	$output .= "</ul>\n";
    	return $output;
    }
    
    function _list_attached_images($mime_type = 'image') {
    	global $post;
    
    	$attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => $mime_type, 'orderby' => 'menu_order ASC, ID ASC') );
    
    	return $attachments;
    }
    
    add_shortcode('medialist', 'media_list_handler');
    Posted: 5 years ago #
  8. vgdog
    Member

    12345

    No kidding !! I completely agree -I am using the media gallery for an artists website and i can't believe the content in the titles or descriptions is not searchable.Such a shame. If anyone has any ideas for me i am all ears.

    Posted: 5 years ago #
  9. Jon Bourne
    Member

    12345

    This is a quick and dirty plugin to display the title, description, and caption. Might come in useful for some folks. Save this code as add-image-descriptions.php and upload it to your plugins directory: /wp-content/plugins/

    
    <?php
    /**
     * Plugin Name: Add Image Descriptions
     * Plugin URI: http://jonbourne.com/
     * Description: Adds titles and descriptions to the captions of embedded images
     * Version: 0.1
     * Author: Jon Bourne
     * Author URI: http://jonbourne.com/
     */
    
    function img_description_caption_shortcode($attr, $content = null) {
    
    	extract(shortcode_atts(array(
    		'id'	=> '',
    		'align'	=> 'alignnone',
    		'width'	=> '',
    		'caption' => '',
    		'description' => 'asdf'
    	), $attr));
    
    	if ( 1 > (int) $width || empty($caption) )
    		return $content;
    
    	$attach = get_post($my_id = str_replace('attachment_','',$id), ARRAY_A);
    
    	$title = $attach['post_title'];
    	$caption = $attach['post_excerpt'];
    	$description = $attach['post_content'];
    
    	if ( $id ) $id = 'id="' . $id . '" ';
    
    	if ( $description ) $description = ' <span class="wp-caption-text-description">'.$description.'</span>';
    
    	return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">' . $content . '<p class="wp-caption-text">' .
    		'<span class="wp-caption-text-title">' . $title . '</span> ' .
    		'<span class="wp-caption-text-caption">' . $caption . '</span> ' .
    		'<span class="wp-caption-text-description">'. $description . '</span>' .
    		'
    </div>';
    
    }
    
    remove_shortcode('wp_caption', 'img_caption_shortcode');
    remove_shortcode('caption', 'img_caption_shortcode');
    
    add_shortcode('wp_caption', 'img_description_caption_shortcode');
    add_shortcode('caption', 'img_description_caption_shortcode');
    
    ?>
    
    Posted: 5 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    8 Votes
  • Status

    This is plugin territory