画像の横にテキストを回り込ませる(Ver3.2以前)
画像を貼る度に「これどうにかしたいよなぁ」と思い続けてたんですが、やっとどうにかできそうです。
Movable Typeのフォルダ内にある/lib/MT/App/CMS.pmの下記の部分
を以下の様に変更。my $link = $thumb ? qq(<img src="$thumb" width="$thumb_width" height="$thumb_height" alt="" />) : q{<MT_TRANS phrase="View image">};
return $app->translate_templatized(<<HTML);
<a href="$url" onclick="window.open('$url','popup','width=$width,height=$height,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false">$link</a>
HTML
} elsif ($q->param('include')) {
if ($thumb) {
return <<HTML;
<a href="$url"><img alt="$fname" src="$thumb" width="$thumb_width" height="$thumb_height" /></a>
HTML
} else {
return <<HTML;
<img alt="$fname" src="$url" width="$width" height="$height" />
HTML
}
} elsif ($q->param('link')) {
return $app->translate_templatized(<<HTML);
<a href="$url"><MT_TRANS phrase="Download file"></a>
HTML
}
参考サイトは我楽さんのMovable Type 3.11-ja アップグレード。【追記】から。hspaceが画像の上下の余白をピクセル単位で設定、vspaceは画像の左右の余白をピクセル単位で設定なので好きな余白幅に指定(私の場合無くしたいので削除)my $link = $thumb ? qq(<img src="$thumb" width="$thumb_width" height="$thumb_height" border="0" align="left" />) : "View image";
return <<HTML;
<a href="$url" target="_blank" onclick="window.open('$url','popup','width=$width,height=$height,
scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,
status=no,left=0,top=0'); return false">$link</a>
HTML
} elsif ($q->param('include')) {
(my $fname = $url) =~ s!^.*/!!;
if ($thumb) {
return <<HTML;
<a href="$url"><img alt="$fname" src="$thumb" width="$thumb_width" height="$thumb_height" align="left" /></a>
HTML
} else {
return <<HTML;
<img alt="$fname" src="$url" width="$width" height="$height" align="left" />
HTML
}
※参照先のサイトさんには自己責任で、と表記があったのでご注意ください。<>を全角表記しているので、半角に直すのを忘れない様。
