Skip to content

Commit

Permalink
show thumbnail feature added.
Browse files Browse the repository at this point in the history
  • Loading branch information
naoaki011 committed Mar 21, 2012
1 parent 5bfb03f commit 90f6922
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions plugins/Assetylene/config.yaml
Expand Up @@ -140,6 +140,9 @@ settings:
convert_html:
default: 0
scope: blog
show_thumbnail:
default: 0
scope: blog
applications:
cms:
callbacks:
Expand Down
27 changes: 27 additions & 0 deletions plugins/Assetylene/lib/Assetylene/CMS.pm
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion plugins/Assetylene/lib/Assetylene/L10N/ja.pm
Expand Up @@ -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;
8 changes: 8 additions & 0 deletions plugins/Assetylene/tmpl/blog_config_assetylene.tmpl
Expand Up @@ -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"
Expand Down

0 comments on commit 90f6922

Please sign in to comment.