at posts/single.html

flickr プラグイン更新

海洋博水族館 (6)

imageプラグインのような右寄せ指定の要望を頂いたので、imageプラグインのように位置を指定できるようにした。

使い方

{{flickr_right 26819172}}

のように、 flickr_right をつけると右寄せになる。

ダウンロード

今回は tar 版のみ。

差分

修正は以下の通り。 デフォルトの class 指定は 'flickr' ではなく、image プラグインと同じ 'photo' にしたほうがいいのかな。

--- plugin-20050901/flickr.rb   Thu Sep  1 03:04:16 2005
+++ plugin-20051018/flickr.rb   Tue Oct 18 09:37:52 2005
@@ -17,9 +22,7 @@
 # Distributed under the GPL
 #

-# @conf['google.maps.apikey'] ||= 'ABQIAAAAxx9GK7QcBGxxh_J1quvpshRDXoJ1dQVVuB1a8beEfw_PrBqdrBTvhAe5SYKcPhjXdm2n-9TNDx3wYg'
-
-def flickr(photo_id, size = nil)
+def flickr(photo_id, size = nil, place = 'flickr')
   unless @conf['flickr.apikey'] || @conf['flickr.apikey'].empty?
     return '[ERROR] flickr.rb: API Key is not specified.'
   end
@@ -29,7 +32,7 @@
   if @cgi.mobile_agent?
     body = %Q|<a href="#{photo[:src]}">#{photo[:title]}</a>|
   else
-    body = %Q|<a href="#{photo[:page]}"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="flickr"|
+    body = %Q|<a href="#{photo[:page]}"><img title="#{photo[:title]}" alt="#{photo[:title]}" src="#{photo[:src]}" class="#{place}"|
     body << %Q| width="#{photo[:width]}"| if photo[:width]
     body << %Q| height="#{photo[:height]}"| if photo[:height]
     body << %Q|></a>|
@@ -55,9 +58,17 @@
   @flickr_encoder.call(body)
 end

+def flickr_left(photo_id, size = nil)
+  flickr(photo_id, size, 'left')
+end
+
+def flickr_right(photo_id, size = nil)
+  flickr(photo_id, size, 'right')
+end
+
 if @conf['flickr.show_map']
   add_header_proc do
-    %Q|<script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=#{@conf['google.maps.apikey']}&amp;hl=en" type="text/javascript"></script>|
+    %Q|\t<script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=#{@conf['google.maps.apikey']}&amp;hl=en" type="text/javascript"></script>\n|
   end

   add_footer_proc do

関連する日記