Categories
WordPress Plugins

Tam-attachment

I’m busy now. Current version of tam-attachment does not work on WordPress 2.1, but I don’t have time to fix it until March. We’re sorry for the inconvenience.

ç¾è¡Œãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® tam-attachment 㯠WordPress 2.1 上ã§æ©Ÿèƒ½ã—ã¾ã›ã‚“。ã™ãã«ç›´ã—ãŸã„ã®ã§ã™ãŒã—ã°ã‚‰ã多忙ã®ãŸã‚3月以é™ã«ãªã‚‹ã¾ã§å¯¾å¿œã§ãã¾ã›ã‚“。ä¸éƒ½åˆã‚’ãŠã‚ã³ã—ã¾ã™ã€‚

» 日本語

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.

Tam-attachment screenshot

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.

<?php
$attachments = $tam_attachment->get_attachments('photo2005');
if ($attachments) {
  foreach ($attachments as $attachment) {
    $attachment = $tam_attachment->get_attachment($attachment);
    echo '<a href="' . $attachment['attachment_link'] . '">';
    echo $attachment['post_title'];
    echo $tam_attachment->get_icon($attachment['ID'], array(128, 128));
    echo $attachment['post_content'];
    echo '</a>';
  }
}
?>

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.

Changelog

Version Date Description
0.1 2006/06/18 Initial release
0.1.1 2006/06/18 Bug fix
0.1.3 2006/07/26 Bug fix

ã“ã®ãƒ—ラグインã¯ä½•ã‹?

Tam-attachment プラグイン㯠WordPress ã®ã‚¢ãƒƒãƒ—ロードファイル管ç†ã®ä»•çµ„ã¿ã«ã„ãã¤ã‹ã®å¼·åŠ›ãªæ©Ÿèƒ½ã‚’追加ã—ã¾ã™ã€‚ã“れを使ãˆã°ãƒ•ã‚¡ã‚¤ãƒ«ã®ã‚¿ã‚¤ãƒˆãƒ«ã‚„説明をã„ã¤ã§ã‚‚好ããªã¨ãã«ç·¨é›†ã§ãるよã†ã«ãªã‚Šã¾ã™ã€‚ã•ã‚‰ã« tam-attachment ã¯æ¬¡ã®ä¾¿åˆ©ãªæ©Ÿèƒ½ã‚’æä¾›ã—ã¾ã™ã€‚

  • オリジナル・サムãƒã‚¤ãƒ«æ©Ÿèƒ½
    WordPress ã«ã¯å…ƒã€…ã€å¤§ãç›®ã®ç”»åƒãƒ•ã‚¡ã‚¤ãƒ«ã‚’アップロードã™ã‚‹ã¨è‡ªå‹•çš„ã«ã‚µã‚¤ã‚ºã‚’縮å°ã—ãŸã‚µãƒ ãƒã‚¤ãƒ«ç‰ˆã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’作æˆã—ã¦ãれる機能ãŒå‚™ã‚ã£ã¦ã„ã¾ã™ã€‚ã—ã‹ã—ç”»åƒãƒ•ã‚¡ã‚¤ãƒ«ä»¥å¤–ã§ã¯ã‚µãƒ ãƒã‚¤ãƒ«ã¯ä½œã‚‰ã‚Œã¾ã›ã‚“。Tam-attachment ã®ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ«æ©Ÿèƒ½ã‚’使ãˆã°å¥½ããªç”»åƒã‚’追加ã®ã‚µãƒ ãƒã‚¤ãƒ«ã¨ã—ã¦ã‚¢ãƒƒãƒ—ロードã§ãるよã†ã«ãªã‚Šã¾ã™ã€‚
  • 後付ã‘アタッãƒãƒ¡ãƒ³ãƒˆæ©Ÿèƒ½
    動画ファイルãªã©ã‚µã‚¤ã‚ºã®å¤§ãã„ファイルを WordPress ã‹ã‚‰ã‚¢ãƒƒãƒ—ロードã—よã†ã¨ã™ã‚‹ã¨ã€PHP ã®ã‚¢ãƒƒãƒ—ロードファイルサイズ制é™(デフォルトã§2MB)ã«ã‚ˆã‚Šã‚¢ãƒƒãƒ—ロードã«å¤±æ•—ã™ã‚‹å ´åˆãŒã‚ã‚Šã¾ã™ã€‚代ã‚ã‚Šã« FTP ã§ãƒ•ã‚¡ã‚¤ãƒ«ã‚’アップロードã™ã‚‹ã“ã¨ã‚‚ã§ãã¾ã™ãŒã€ãã®å ´åˆ WordPress ãŒã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã¨ã—ã¦ç®¡ç†ã§ããªããªã‚‹ã®ã§ã€å¾Œã§ç®¡ç†ã™ã‚‹ã¨ãã«ä¸ä¾¿ã«ãªã‚‹ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。Tam-attachment ã®å¾Œä»˜ã‘アタッãƒãƒ¡ãƒ³ãƒˆæ©Ÿèƒ½ã‚’使ãˆã°ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã¨ã—ã¦ç®¡ç†ã•ã‚Œã¦ã„ãªã„ファイルを見ã¤ã‘出ã—ã€å¾Œä»˜ã‘ã§ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã‚’作æˆã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚
  • タグ機能
    個々ã®ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã«ã¤ã„ã¦ãƒ—レーンテキストã®ã‚¿ã‚°ã‚’付ã‘ã¦ç®¡ç†ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚指定ã—ãŸã‚¿ã‚°ã‚’æŒã¤ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã‚’é¸æŠžçš„ã«ãƒªã‚¹ãƒˆã‚¢ãƒƒãƒ—ã™ã‚‹ã“ã¨ãŒã§ãã‚‹ã®ã§ã€ç”»åƒã®ã‚°ãƒ«ãƒ¼ãƒ—管ç†ãªã©ã«ä¾¿åˆ©ã§ã™ã€‚

Tam-attachment ã«ã¯æ‰±ã„ãªã‚ŒãŸãƒã‚¹ãƒˆã‚„ページã®ã‚¤ãƒ³ã‚¿ãƒ•ã‚§ã‚¤ã‚¹ã¨åŒæ§˜ã®æ ¼å¥½è‰¯ã„エディット・パãƒãƒ«ãŒå‚™ãˆã‚‰ã‚Œã¦ãŠã‚Šã€ã‚¹ãƒ©ãƒƒã‚°ã‚„é †åºã€ãƒ‡ã‚£ã‚¹ã‚«ãƒƒã‚·ãƒ§ãƒ³è¨­å®šã€ãƒ‘スワードä¿è­·ã€è¦ªãƒã‚¹ãƒˆã€ã•ã‚‰ã«ã‚«ã‚¹ã‚¿ãƒ ãƒ»ãƒ•ã‚£ãƒ¼ãƒ«ãƒ‰ã®ç·¨é›†ã‚’ãã“ã§è¡Œãªã†ã“ã¨ãŒã§ãã¾ã™ã€‚

使ã„æ–¹

ã¾ãšãƒ•ã‚¡ã‚¤ãƒ«ã‚’アップロードã—ã¦ä¸‹ã•ã„。アップロードã™ã‚‹ã«ã¯æ¨™æº–ã®ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ãƒ»ã‚¢ãƒƒãƒ—ローダを使ã£ã¦ã‚‚構ã„ã¾ã›ã‚“ã—ã€æ–°ã—ã„ [Manage] » [Attachment] パãƒãƒ«ã‹ã‚‰è¡Œãªã†ã“ã¨ã‚‚ã§ãã¾ã™ã€‚[Manage] » [Attachment] パãƒãƒ«ã§ã¯ã€ã‚‚ã—アップロード・ディレクトリã®ä¸­ã«ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆåŒ–ã•ã‚Œã¦ã„ãªã„ファイルãŒè¦‹ã¤ã‹ã‚Œã°ã€ã“れをãŠçŸ¥ã‚‰ã›ã—ã¦å¾Œä»˜ã‘アタッãƒãƒ¡ãƒ³ãƒˆã‚’促ã—ã¾ã™ã€‚

ãã®å¾Œã¯è¡¨ç¤ºã•ã‚Œã‚‹ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆä¸€è¦§ã‹ã‚‰é¸æŠžã—ã¦ã€[Write] » [Write Attachment] パãƒãƒ«ã‹ã‚‰ç·¨é›†ãŒå¯èƒ½ã«ãªã‚Šã¾ã™ã€‚ã“ã®ãƒ‘ãƒãƒ«ã®ã‚µã‚¤ãƒ‰ãƒãƒ¼ã‹ã‚‰ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ«ã®ã‚¢ãƒƒãƒ—ロードãŒå¯èƒ½ã§ã™ã€‚ã¾ãŸã€ã‚¿ã‚°ã®å…¥åŠ›ã‚‚下部ã®ãƒãƒ¼ã‹ã‚‰è¡Œãªã†ã“ã¨ãŒã§ãã¾ã™ã€‚

テンプレート関数

テンプレートã®ä¸­ã§ä½¿ãˆã‚‹é–¢æ•°ãŒã„ãã¤ã‹ç”¨æ„ã•ã‚Œã¦ã„ã¾ã™ã€‚

  • $tam_attachment->get_attachments($tags)

    アタッãƒãƒ¡ãƒ³ãƒˆã® ID ã‹ã‚‰ãªã‚‹é…列を返ã—ã¾ã™ã€‚$tags を指定ã™ã‚‹ã¨ã€æŒ‡å®šã•ã‚ŒãŸã‚¿ã‚°ã‚’æŒã¤ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã ã‘ã‚’è¿”ã—ã¾ã™ã€‚$tags ã¯é…列ã‹ã€ã‚¹ãƒšãƒ¼ã‚¹åŒºåˆ‡ã‚Šã®æ–‡å­—列値ã§æŒ‡å®šã§ãã¾ã™ã€‚

  • $tam_attachment->get_attachment($post)

    å˜ä¸€ã®ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã®ãƒ—ロパティã‹ã‚‰ãªã‚‹é€£æƒ³é…列を返ã—ã¾ã™ã€‚$post ã«ã¯ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã® ID を指定ã—ã¾ã™ã€‚è¿”ã•ã‚Œã‚‹ãƒ—ロパティã«ã¯é€šå¸¸ã® Post ã‹ã‚‰å¼•ã継ã„ã ã‚‚ã®ã«åŠ ãˆã¦æ¬¡ã®4個ãŒè¿½åŠ ã•ã‚Œã¾ã™:

    • attachment_link ã¯ã€ã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã® URL ã§ã™ã€‚
    • thumbnail_link ã¯ã€ã‚µãƒ ãƒã‚¤ãƒ«ã® URL ã§ã™ã€‚
    • original_thumbnail_link ã¯ã€ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ«ã® URL ã§ã™ã€‚
    • tags ã¯ã€ã‚¿ã‚°ã®æ–‡å­—列ã§ã™ã€‚
  • $tam_attachment->original_thumbnail_url($id)

    $id 㧠ID を指定ã—ãŸã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã®ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ«ã® URL ã‚’ echo ã§å‡ºåŠ›ã—ã¾ã™ã€‚

  • $tam_attachment->get_original_thumbnail_url($id)

    $id 㧠ID を指定ã—ãŸã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã®ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ«ã® URL ã‚’ return ã§è¿”ã—ã¾ã™ã€‚

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

    $post 㧠ID を指定ã—ãŸã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã®ã‚¢ã‚¤ã‚³ãƒ³ç”»åƒã‚’ <img/> ã‚¿ã‚°ã¨ã—ã¦å‡ºåŠ›ã—ã¾ã™ã€‚アイコン画åƒã®ã‚½ãƒ¼ã‚¹ã¯ã‚ªãƒªã‚¸ãƒŠãƒ«ãƒ»ã‚µãƒ ãƒã‚¤ãƒ« » サムãƒã‚¤ãƒ« » フルサイズ画åƒã®é †ã§ã‚ã‚‹ã‚‚ã®ã‚’é¸ã‚“ã§ä½¿ã„ã€ã©ã‚Œã‚‚ãªã‘れ㰠tam-attachment プラグインã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªå†…ã® noimage.png ãŒä½¿ã‚ã‚Œã¾ã™ã€‚

    $max_dims ã®æŒ‡å®šã¯ã‚ªãƒ—ションã§ã€ã‚¢ã‚¤ã‚³ãƒ³ã‚µã‚¤ã‚ºã®å¹…ã¨é«˜ã•ã‹ã‚‰ãªã‚‹é…列を渡ã—ã¾ã™ã€‚アイコンサイズã¯ã“ã“ã§æŒ‡å®šã•ã‚ŒãŸã‚µã‚¤ã‚ºã«æœ€å¤§å€¤ãŒåˆ¶é™ã•ã‚Œã€å…ƒã‚µã‚¤ã‚ºãŒå¤§ãã„å ´åˆã¯ <img/> ã‚¿ã‚°ã® width 㨠height 属性ã®æŒ‡å®šã§ç¸®å°ã•ã‚Œã¾ã™ã€‚

ダウンロードã¨ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«

ã“ã“ã‹ã‚‰ zip ファイルをダウンロードã—ã¦ã€<WP_INSTALL>/wp-content/plugins/ ディレクトリã«å±•é–‹ã€ã‚ã¨ã¯ WordPress ã«ãƒ­ã‚°ã‚¤ãƒ³ã—㦠plugins パãƒãƒ«ã§æœ‰åŠ¹åŒ–ã—ã¦ä¸‹ã•ã„。

日本語翻訳パッケージã¯ã“ã“ã‹ã‚‰ãƒ€ã‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã—ã¦ä¸‹ã•ã„。展開ã™ã‚‹ã¨ tam-attachment-ja.mo 㨠tam-attachment-ja.po ã®2ã¤ã®ãƒ•ã‚¡ã‚¤ãƒ«ãŒå…¥ã£ã¦ã„ã‚‹ã®ã§ã€tam-attachment-ja.mo ã‚’ <WP_INSTALL>/wp-content/plugins/ 直下ã«ç½®ãã€æ‰‹é †ã«å¾“ã„ WPLANG ã‚’ ja ã«æŒ‡å®šã—ã¦ä¸‹ã•ã„。WPLANG ã®æŒ‡å®šã‚’変更ã§ããªã„å ´åˆã¯ tam-attachment-ja.mo ã®æ–¹ã®åå‰ã‚’既定㮠WPLANG ã«åˆã‚ã›ã¦(例ãˆã° tam-attachment-ja_UTF.mo ãªã©ã«)変更ã—ã¦ã‚‚構ã„ã¾ã›ã‚“。

4 replies on “Tam-attachment”

[…] Anne aime triturer ses photos, elle passe des heures à réécrire les titres et descriptions (le plugin Tam Attachment permet de le faire très simplement). Seulement, les fonctionnements de Lightbox et de WordPress ne permettent pas de mettre à jour les billets automatiquement avec les nouvelles données éditoriales. Elle était obligée de réécrire ses textes dans ses billets. […]

ã“ã®ãƒ—ラグインã€åˆ©ç”¨ã•ã›ã¦ã„ãŸã ã„ã¦ã¾ã™ã€‚
質å•ãªã®ã§ã™ãŒã€ã“ã®ãƒ—ラグインã§ä½œæˆã—ãŸã‚¢ã‚¿ãƒƒãƒãƒ¡ãƒ³ãƒˆã‚’ゲストユーザーã«ã‚‚閲覧å¯èƒ½ã«ã™ã‚‹ã«ã¯ã©ã†ã—ãŸã‚‰è‰¯ã„ã§ã—ょã†ã‹?

ゲストユーザã«ã‚‚閲覧å¯èƒ½ãªã¯ãšãªã‚“ã§ã™ãŒã€ã§ãã¾ã›ã‚“ã§ã—ãŸã‹?
ãƒã‚°ã®å¯èƒ½æ€§ã‚‚ã‚ã‚‹ã®ã§è©³ã—ã状æ³ã‚’æ•™ãˆã¦ã‚‚らãˆã‚‹ã¨åŠ©ã‹ã‚Šã¾ã™ã€‚
プラグインã¯æœ€æ–°ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³(0.1.3)を使ã£ã¦ã¾ã™ã‹?

MOO ã•ã‚“ã€
追記ã—ã¾ã™ã€‚ãã†ã„ãˆã°æ˜”ãã‚“ãªè©±ã‚’ã—ãŸã‚ˆã†ãªæ°—ãŒã™ã‚‹ãªã¨æ€ã£ã¦è¨˜æ†¶ã‚’ãŸã©ã£ã¦ãªã‚“ã¨ã‹æ€ã„出ã—ã¾ã—ãŸã€‚
アタッãƒãƒ¡ãƒ³ãƒˆãŒã‚²ã‚¹ãƒˆãƒ¦ãƒ¼ã‚¶ã‹ã‚‰è¦‹ãˆãªã„ã¨ã„ã†ã®ã¯ãƒ—ラグインã®ãƒã‚°ã§ã¯ãªã WP å´ã®ãƒã‚°ã§ã™ã€‚wp-includes/classes.php ã® 660行目ã‚ãŸã‚Šã«ä»¥ä¸‹ã®ã‚ˆã†ãªã‚³ãƒ¼ãƒ‰ãŒã‚ã‚Šã¾ã™ã€‚


// Check post status to determine if post should be displayed.
if ( !empty($this->posts) && $this->is_single ) {
$status = get_post_status($this->posts[0]);
if ( ('publish' != $status) && ('static' != $status) ) {

ã“ã‚Œã®æœ€å¾Œã®è¡Œã‚’次ã®ã‚ˆã†ã«å¤‰ãˆã‚‹ã¨ã†ã¾ãã„ãã¨æ€ã„ã¾ã™ã®ã§è©¦ã—ã¦ã¿ã¦ãã ã•ã„。

if ( ('publish' != $status) && ('static' != $status) && ('attachment' != $status) ) {

ã“ã®ãƒã‚°ã¯ WP 2.1 ã§ã¯ãŸã¶ã‚“修正済ã¿ã ã¨æ€ã„ã¾ã™ãŒã€WP 2.1 ã«ã¯ Tam-attachment ãŒã¾ã å¯¾å¿œã§ãã¦ã¾ã›ã‚“… :(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s