Summary

Tam-attachment is a WordPress plugin which adds some powerful functionality to native file attachments mechanism. This plugin allows you to edit file title and description at any time, not only at file uploading time. And also it offers a couple of useful features like …

Original thumbnail
You know WordPress takes care of making thumbnail image by scaling original one down automatically. But when the file isn’t an image, WP can’t do that. Tam-attachment’s original thumbnail feature allows you to upload your favorite image as extra thumbnail.

After attachment
When you want to upload big size file like movies, it may over PHP’s limit of upload file size. Then you resignedly upload it via FTP, but FTP uploading can’t make attachment entry on WordPress DB, so the file gets orphaned. Tam-attachment’s after attachment feature help you dig the orphan files up and create attachment entry for them.

Tagging
You can tag the attachments by words. You can also pick up all attachments with specific tag, so it’s useful for grouping attachments.

The plugin has own good-looking edit panels similar to the familiar Post and Page edit panels. You can edit slags, order, discussion settings, password, parent post and custom fields on it.

Usage

You can upload files via either native inline uploader or new [Manage] » [Attachment] panel. In the panel if you have orphaned files or files without attachment in your upload directory, they will be shown and suggest creating attachment for them. [After attachment feature]

Then you can select an attachment in Attachment Management pane and edit your attachment in new [Write] » [Write Attachment] panel. In the panel, you can upload extra thumbnail image from Files sidebar. [Original thumbnail feature]

And you can put tags from Tags bar. [Tagging feature]

Template functions

There are some template functions you can use in template PHP:

$tam_attachment->get_attachments($tags)

Returns all attachment’s ID as an array. If you specify optional $tags, it returns attachments with specified tags. $tags can be an array of words or a string of words separated by space.

$tam_attachment->get_attachment($post)

Returns properties of specified attachment as an associative array. The attachment is specified by the ID of itself as $post. The returned properties includes the properties from Post and additional four:

attachment_link has URL for the attachment,

thumbnail_link has URL for the thumbnail,

original_thumbnail_link has URL for the original thumbnail and

tags has the tag string of the attachment.

$tam_attachment->original_thumbnail_url($id)

Displays the URL for the original thumbnail of the attachment specified by the $id.

$tam_attachment->get_original_thumbnail_url($id)

Returns the URL for the original thumbnail of the attachment specified by the $id. This function does not display, so useful using it as an argument of other function.

$tam_attachment->get_icon($post, $max_dims)

Displays an <img/> tag refers to icon image of the attachment specified by the $post. $post is the ID of the attachment. The source of the icon image is 1) the original thumbnail, 2) the thumbnail, 3) full size image, searching this order and picking up the first one. If you get none of them, noimage.png in the plugin directory is used.

Optional $max_dims gets an array of two integers, the max width and height of the icon image as pixel size. If you have larger image than this limit, the displayed image will be scaled down by width and height attributes of the <img/>.

Here is an example. Getting attachments with tag ‘photo2005’ and display the title, icon image which limited by the size 128×128, content and link to the attachment.

Download and Installation

You can download the plugin’s zip file here. After you download the zip, you’ll need to unzip it to your <WP_INSTALL>/wp-content/plugins/ directory. Then log into WordPress and activate the plugin from within your plugins panel.