毎日モザイク

White Room Layout Works

2009-05-26T05:29:11+09:00 [Tue]
--> [日常]

チョッパー捕獲。

2009_05_26_1

以前、ご子息(誤用)がローソンでリラックマA賞をかっぱいだ一番くじですが、つい出来心でファミマでチャレンジしてしまいました。

ご覧の有様ですよ。

2009-05-25T07:34:54+09:00 [Mon]
--> [Ubuntu]

html validator

こないだの作業のときに使って、入れっぱなしにしてたんですが、激しく遅くなるんで止めました。

環境は、

  • Ubuntu 8.04LTS
  • firefox 3.0.10
  • html validator 0.8.5.6

症状は、

  • 右クリックするとメニューが出てくるのが激しく遅い。
  • スクロールが激しく遅い。
  • 何もかもが遅い。
  • その時、CPU使用率は100%。

表示する度にチェックするんなら、当然といえば当然なんですが、その機能をoffにしても、なんか動いてるっぽいです。自動チェック機能をオフにする機能が機能していない感じです。

ほかのadd-onと当たってるかもしんないと思って、html validatorだけにしてみましたが、同じでした。

使う機会は滅多に無いんで、使うときだけ有効にするようにしました。

2009-05-02T23:35:22+09:00 [Sat]
--> [日常]

新しいギターを見せてあげる

http://mainichi.jp/enta/art/news/20090503k0000m040102000c.html

さよなら、キヨシロー。

2009-04-28T14:58:01+09:00 [Tue]
--> [WordPress]

作業軽減策。

MD Comics Neoのページですが、やっつけ風味の仕様になっていた、画像のタグ入れ部分を、爆乳様(仮名)の負担を軽減するためと、ミスする隙を埋めるために、仕様変更しました。

取り合えず要求仕様を満たすために、それぞれのサイズのタグをカスタムフィールドに入れるという、非常に回りくどい手順になっていましたが、その部分をこちらこちらを参考にして、勝手にやってくれるようにしました。もはや、「投稿に挿入」すら必要ありませんw。

/* functions.php*/
function get_the_post_image($postid,$size,$order=0,$max=null) {
    $attachments = get_children(array(
                                    'post_parent' => $postid,
                                    'post_type' => 'attachment',
                                    'post_mime_type' => 'image'
                                    ));
    if ( is_array($attachments) ){
        foreach ($attachments as $key => $row) {
            $mo[$key]  = $row->menu_order;
            $aid[$key] = $row->ID;
        }
        array_multisort($mo, SORT_ASC,$aid,SORT_ASC,$attachments);
        $max = empty($max)? $order+1 :$max;
        
        for($i=$order;$i<$max;$i++){
            $the_image = $attachments&#91;$i&#93;;
            $attachmenturl = wp_get_attachment_url($the_image->ID);
            $attachmentimage = wp_get_attachment_image($the_image->ID, $size );
            $img_title = $the_image->post_title;
            $img_desc = $the_image->post_excerpt;
            $img_alt = $the_image->post_name;
            
            if ($size == "thumbnail" || $size == "medium"){
                $attachmentimage = preg_replace('/class="attachment.*?"/','class="alignright size-'.$size.'"',$attachmentimage);//CSSに合わせるため
                 $attachmentimage = preg_replace('/alt=".*?"/','alt="'.attribute_escape($img_alt).'"',$attachmentimage);//altが直接拾えないので
                echo '<a href="'.clean_url($attachmenturl).'" rel="lightbox&#91;'.get_the_ID().'&#93;" title="'.attribute_escape($img_title).'">'.$attachmentimage.'</a>';
            } elseif($size == "large") {
                $attachmentimage = preg_replace('/class="attachment.*?"/','class="alignright size-'.$size.'"',$attachmentimage);
                 $attachmentimage = preg_replace('/alt=".*?"/','alt="'.attribute_escape($img_alt).'"',$attachmentimage);
                echo $attachmentimage;
            } else {
                echo '<img src="'.clean_url($attachmenturl).'">';
            }
            
        }
        
    }
    
}
/* index.phpなどでの呼び出し部分*/
<?php  get_the_post_image(get_the_ID(), 'thumbnail', 0, 1); ?>
/* get_the_post_image($post_id, $size, $order, $max)
$post_id= 記事ID
$size = 画像のサイズ(thumbnail,medium,large,full)
$order = ギャラリーでの順番
$max = $orderから何枚使うか
*WebTecNoteさんより拝借。*
*/

WebTecNoteさんから、記事に添付された画像をソートする部分を拝借して、Forumからデータを拾う部分をいただいて、くっつけただけのものですが……。

これで、扉ページと、個別ページと、リストページに、それぞれ、何もせずに予定どおりの画像が入るようにできました。

先人の皆さんに感謝。

2009-04-24T21:29:59+09:00 [Fri]
--> [労働]

開店。

MDComicxNeoのホームページが開店しました。

今後も、ちまちま、小変更をすると思いますが、なんとかかんとか。

ただ、旧世代環境はざっくり無視したので、古い環境だとほとんどどうにもなってません(OS9のIEとか悲惨)。

画像表示に非標準な方法を使っているので、プラグインで出しているケータイ向けでは、文字情報しか見られませんが、その辺は改造していく予定です。