- 2009-03-06 [ 18:24 ]
- プラグイン
概要:
このプラグインは、投稿記事内にあるイメージタグを解析し、そのうち1点のみを参照元イメージ画像サムネイル化及びキャッシュ化するという機能を持っています。記事一覧等のインデックス生成や、携帯コンテンツ向のテーマカスタマイズを目的に開発しました。
特徴:
QF-GetThumb には、以下のような特徴があります。
- 出力テーマ(ページ)毎に引数で好きなサムネイルサイズを指定できる。
- サムネイル化だけでなく、トリミングも可能。
- 一度サムネイル化した画像は、キャッシュとして蓄積。
- 元画像が更新されれば、自動的にキャッシュも更新される。
- 画像の参照先は、同一サーバだけでなく外部サーバも可能。
- 記事内のどの画像を取り出すか、条件指定が可能。
- 扱える画像はJPEG、GIF、PNGの3種類。
ダウンロード:
アーカイブ:QF-GetThumb 1.0 zip
インストール:
インストールは以下の手順です。
- ダウンロードしたアーカイブを解凍し、フォルダごと Wordpress のプラグインディレクトリに放り込む。
- 管理画面よりプラグインを有効化。
- 管理画面の「設定」より、必要な設定を行う。
※インストール時に自動設定が行われます。デフォルト設定でほぼ、動作可能なはずです。 - テーマファイルのの「while (have_posts()){~」ループ内に、以下のコードを挿入する。<?php echo the_qf_get_thumb_one(); ?>必要応じてオプションを設定する。
※オプションについては、後述で説明します
設定:
パラメータ設定例:
<?php echo the_qf_get_thumb_one(’num=0&width=160′); ?>
パラメータ設定が少々分かりにくいので、まずは設定例の値を試しに挿入してみる事をオススメします。パラメータの記述が正確にされていれば、記述の順序は問題ありません。
上記の例ですと「num=0&width=160」でも「width=160&num=0」でも表示結果は変わりません。
各パラメータの説明は、以下の通りです。
- num : (デフォルト / 0)
記事内の画像のうち、何番目の画像を表示するかの設定です。画像順序は、記事のHTMLコード記述順で決定します。配列と同じく、番号は0から始まるので注意して下さい。尚、指定番号が記事内の画像数を上回る場合は、一番末尾の画像が表示されます。

- width : (デフォルト / 0)
サムネイル画像の幅です。単位はピクセルになります。横幅指定があった場合、画像の幅は指定のサイズに縦横比保持でリサイズされます。例えば指定が幅100pxの場合、幅150pxの画像は横幅100pxに縮小、横幅80pxの画像は横幅100pxに拡大されます。

- height : (デフォルト / 0)
サムネイル画像の高さ指定です。基本的な設定は、width と同じです。 - tag : (デフォルト / 1)
イメージタグを返すか返さないかの設定です。0の場合(返さない場合)は画像のURLのみを返し、0の場合(返す場合)はイメージタグ付でソースを返します。

- global : (デフォルト / 0)
外部サーバの画像をキャッシュ化するかしないかの設定です。0の場合は外部サーバの画像は対象外とし、1の場合は外部サーバの画像もサムネイル化します。キャッシュ化を行う場合、直リンクと違いリサイズ(自サーバに画像をコピー)という事になる為、著作権絡みの問題が生じる可能性がありますので、ご注意下さい。(その為デフォルトは0指定になっています)ここでの外部サーバとは、QF-GetThumbの設定画面で指定されたドメイン以外全てにあたります。

- crop_w : (デフォルト / 0)
画像トリミング時の幅指定です。単位はピクセルで、ここで指定された幅にトリミングが行われます。デフォルト値の場合、トリミングは行われません。トリミングは必ずリサイズ後に行われます。例えば、元サイズが 幅150px の画像を width 指定 100px にした上、80px でトリミングした場合、まず最初に150pxから100pxへ画像のリサイズ(縮小)が行われた上で、100px - 80px の差分である 20px が画像の両サイドからそれぞれ 10px ずつ切り取られます。基準は必ず画像の中央となり、外側からトリミングが行われる仕様となっています。

- crop_h : (デフォルト / 0)
画像トリミング時の高さ指定です。基本的な設定は、crop_w と同じです。 - find : (デフォルト / 空文字列)
イメージタグの文字列検索指定です。特定の文字列を含むイメージタグのみ、サムネイル化の対象とする事が出来ます。文字列はイメージタグに含まれる内容なら、全て該当します。例えば、特定ディレクトリパスを持っている画像や、CSSで特定のclassやaltを持つ画像のみをサムネイル化対象にする事が出来ます。num パラメータと併用出来るので、find で対象をある程度絞った後、num で取り出す画像位置を厳密に決める等の処理が可能です。

パラメータ以外に、デフォルト画像の指定も可能です。デフォルト画像とは、記事内に対象となるイメージが一切存在しなかった場合に表示する画像です。例えば記事内に画像がない時には「NowPrinting」のような画像を表示させたい場合に使います。指定がない場合、QF-GetThumbプラグインフォルダ内に添付してあるデフォルト画像が自動挿入されます。
設定は、以下のようにして下さい。
<?php echo the_qf_get_thumb_one(’width=100′,’デフォルト画像パス‘); ?>
デフォルト画像のパスは、絶対パスでも相対パスでも問題ありません。
それと一点、注意事項というか、ややこしい設定があります。
画像の width と height を両方指定した場合は、その両方に納まるサイズでリサイズが行われます。例えば、width=100、height=100 を設定した場合、幅150px、高さ200px の画像は幅75px、高さ100pxにリサイズされます。Wordress と同じ仕様です。
幅か高さどちらかだけ調整を取れれば良い場合は両方の値を指定せず、片方だけ指定するのが良いでしょう。尚、縦横比は必ず保持する指定にしていますが、もし縦横比の保持をしたくない場合は、tag=0でイメージURLのみを出力し、テーマ内でタグの値を強制的に指定する等すれば可能です。
プラグイン開発の基礎は設計にアリ!
まずはUMLの勉強をしてみませんか?
[ PR ] ダイアグラム別 UML徹底活用
[ PR ] IT技術者を目指すなら必須の国家資格、基本情報技術!
[ Wikipedia ] UMLとは?
[ Wikipedia ] 基本情報技術者とは?
- Newer: WassUp バグレポート
コメント:14
- baron 09-03-09 [ 03:02 ]
-
Works great, thank you
- zeitweise 09-03-09 [ 05:59 ]
-
Thank you very much for the effort of writing this plugin. I have been looking for something such as this for a long time!
As far as I understand this plugin is supposed to catch an image from the content of a post and generate a teaser thumbnail picture for it - right?
I set up a test blog (http://dev.q-tipp.org/buddypress/) and included the sample setting into my template. However, no picture is returned. Instead, only for all posts that contain a picture from the mediathek the images alt-text is displayed, i.e. on the first post on my blog “Inteam-Club-Flyer”. For all posts that only reference a picture from somewhere on the internet, nothing happens.
How can I make the plugin display the pictures?
Once again, thanks a lot for tackeling this!
- Li-An 09-03-09 [ 17:03 ]
-
As I am using the old Post Thumb Revisited plugin http://www.alakhnor.com/post-thumb what is not supported anymore and it seems your plugin is very similar in the options. As I understand (sorry but I’m french), the creation of the thumbnail is automatic without use of custom field ?
- admin 09-03-09 [ 20:16 ]
-
> baron
I wish to express our gratitude for the thing that you used QF-GetThumb!
Do you use QF-GetThumb, and are not there any problems?
You can submit the report to me if there is a problem by using QF-GetThumb.
Thanks! - admin 09-03-09 [ 20:20 ]
-
> zeitweise
I wish to express our gratitude for the thing that you used QF-GetThumb!
I referred to a test blog that you had set up.
There seems to be a problem in a path of thumbnail.
QF-GetThumb automatically does all the settings.
However, QF-GetThumb might not operate normally according to the setting of the server.
At that time, you should set QF-GetThumb with the manual.
In my explanation, there was no explanation concerning the manual setting.
Sorry, this thing confused you.You must look at the setting of QF-GetThumb.
Settings -> QF-GetThumbPlease give the report to me, if you do not understand.
Because this is a setting of the server, you might think security to be uneasy.
In that case, please give mail from the mail form to me.Thank you for reporting!
- admin 09-03-09 [ 20:25 ]
-
> kudi
I wish to express our gratitude for the thing that you used QF-GetThumb!
Do you use QF-GetThumb, and are not there any problems?
You can submit the report to me if there is a problem by using QF-GetThumb.
Thanks!I’m sorry kudi.
I have erased your comment by mistake.
It is very regrettable though was terrible and glad… - admin 09-03-09 [ 20:26 ]
-
> Li-An
I wish to express our gratitude for the thing that you used QF-GetThumb!
Sorry, I am Japanese, So it is not good at English.QF-GetThumb was made like your having been guessed referring to “PosThumb”.
It is that that looks like set item very much.
However, it is a quite different specification as for the function.
I made QF-GetThumb because there was a part where my purpose was not able to be achieved by “PosThumb” though I was patronizing “PosThumb”.
However, It is thought that “PosThumb” is a very excellent plug-in now.The custom field is not necessary of thumbnail generation.
The image of an arbitrary part can be extracted from the content source code.
You can have them automatically extract the favorite one of images that contain it in the content by one point.Target data of the content alone for making to the thumbnail and the custom field cannot be specified if it says oppositely.
In the future, I want to improve the custom field and in the excerpt to the object of the image extraction and the plug-in that can be done. - Li-An 09-03-11 [ 22:55 ]
-
Thank you for your precisions. I will keep an eye on your plugin and it’s evolutions. For the moment, the only thing it does not have for my purposes is the “list of thumbnails (random)” I use with Post Thumb. And the video thumb that was a great trick (but if you insert custom fields, maybe it will solve the problem).
- admin 09-03-12 [ 12:04 ]
-
> Li-An
Random is a wonderful idea!
I will add this function to QF-GetThumb in the near future.
The correspondence of the_excerpt and custom_field has already been completed though it is a test stage.
The case site of the sample of QF-GetThumb is made now.
I will distribute QF-GetThumb ver1.1 as soon as completing the case site. - Li-An 09-03-13 [ 06:29 ]
-
I see another “problem” with your plugin vs Post Thumb. With your plugin, there is only one thumb created for each post, no ? Post Thumb gives the possibility to define a given name and even a given folder to put the created thumbnails.
- forte 09-03-13 [ 16:54 ]
-
はじめまして。
このプラグインいいですね。
設定についての質問です。4.テーマファイルのの「while (have_posts()){~」ループ内に、以下のコードを挿入する。
とありますが
どのファイルのことですか?
全ファイルに文字列の検索かけてもひっかかりませんよろしければ教えてくださいませんか?
- admin 09-03-13 [ 18:43 ]
-
> Li-An
QF-GetThumbs makes only one per each content thumbnail.
Making the folder is set to make not each thumbnail but each size of image.
The thumbnail that’s width is 100px and height is 80px is preserved in the folder named all 100×80.I am not a translation that starts making the same one as PostThumb.
Therefore, it is not thought that all functions of PostThumb are covered.
The first purpose that I made QF-GetThumb is in the acquisition of an arbitrary image in the content.
The image data registered in the media data base most recently is taken out by priority for PostThumb from among the image included in the content.
As for this specified condition, it is a big reason why the thing flexibly done made QF-GetThumb. - admin 09-03-13 [ 18:43 ]
-
> forte 様
投稿ありがとうございます。
同じ日本人の方からは、初の投稿・問い合わせなので凄く嬉しいです。コードの挿入箇所ですが、私の記述が良くありませんでした。
テーマにより、開始箇所に若干の差異があります。
このコードはありますか?「while (have_posts())」
若しくは、「the_content」の周辺なら問題ありません。
要は、記事出力のループ文内なら何処でも…という事です。マニュアルは作っていますが、分かりにくい箇所が多々あると思います。
まだ公開して1週間も経過していないプラグインの為、不備も多いかもしれません。
今後、プラグインを充実させる為にも、色々なご意見を頂けると助かります。その他、分からない箇所等ありましたら、遠慮なくお問合せ下さい。
もし、セキュリティに関わるような内容で、コメントでの公開を躊躇される場合は、メールフォームからの問い合わせでも構いません。
日中は仕事の関係で対応が遅れるかもしれませんが、出来る限り迅速なサポートを心掛けるつもりです。
今後とも、よろしくお願い致します。 - Li-An 09-03-14 [ 03:17 ]
-
OK
トラックバック:0
- このエントリーへのトラックバックURL
- http://la-passeggiata.com/admin/wp-trackback.php?p=1
- このトラックバックの参照先
- QF-GetThumb 1.0 リリース from la passeggiata
