Permalink
Browse files

show thumbnail feature added.

  • Loading branch information...
naoaki011 committed Mar 21, 2012
1 parent 5bfb03f commit 90f6922a1828bb4d408077378589bb6e1758c3d4
@@ -140,6 +140,9 @@ settings:
convert_html:
default: 0
scope: blog
show_thumbnail:
default: 0
scope: blog
applications:
cms:
callbacks:
@@ -445,6 +445,33 @@ HTML
}
$tmpl->insertBefore($opt, $el);
#< Caption
# Asset Thumbnail >
my $show_thumbnail = $plugin->get_config_value('show_thumbnail',$scope) || 0;
if ($show_thumbnail) {
my %param;
$param{Width} = 150;
my ( $thumbnail, $w, $h ) = $asset->thumbnail_file( %param );
(my $site_path = $blog->site_path) =~ s!\\!/!g;
(my $site_url = $blog->site_url) =~ s!https?://[^/]+/!/!;
my $regex_path = quotemeta( $site_path );
$thumbnail =~ s!\\!/!g;
$thumbnail =~ s/^$regex_path/$site_url/;
$thumbnail =~ s!//!/!g;
$opt = $tmpl->createElement('app:setting', {
id => 'asset_thumbnail',
label => MT->translate('Asset Thumbnail'),
label_class => 'no-header',
hint => '',
show_hint => 0,
});
$opt->innerHTML(<<HTML);
<div>
<img src="$thumbnail" width="$w" height="$h" style="border: 1px solid #ccc; padding: 5px; background-color: #fff;" />
</div>
HTML
$tmpl->insertBefore($opt, $el);
}
#< Asset Thumbnail
# Remove Popup >
my $remove_popup = $plugin->get_config_value('remove_popup',$scope);
if ($remove_popup) {
@@ -59,7 +59,8 @@ use vars qw( %Lexicon );
'Create Insertion Module' => 'モジュールを作成',
'Set alt attribute in image?' => '画像にalt属性を設定する',
'and Save as' => '値を保存する',
'Show Thumbnail' => 'サムネイルを表示',
'Show Asset Thumbnail' => 'アイテムのサムネイルを表示する',
);
1;
@@ -199,6 +199,14 @@
<input type="checkbox" name="convert_html"<mt:if name="convert_html"> checked="checked"</mt:if> value="1" />
</mtapp:setting>
<mtapp:setting
id="convert_html"
label="<__trans phrase="Show Thumbnail">"
hint="<__trans phrase="Hint">">
<label for="show_thumbnail"><__trans phrase='Show Asset Thumbnail'></label>
<input type="checkbox" name="show_thumbnail"<mt:if name="show_thumbnail"> checked="checked"</mt:if> value="1" />
</mtapp:setting>
<div id="module_installed" style="display:*module_installed*;">
<mtapp:setting
id="create_module"

0 comments on commit 90f6922

Please sign in to comment.