tdiary-contrib 3.2.2.20130518
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +35 -0
- data/README.en.md +12 -0
- data/README.md +13 -0
- data/Rakefile +41 -0
- data/doc/en/filter/spambayes.txt +3 -0
- data/doc/en/plugin.txt +1 -0
- data/doc/en/style/hatena.txt +10 -0
- data/doc/en/style/markdown.txt +16 -0
- data/doc/en/util.txt +1 -0
- data/doc/ja/filter/antirefspam.history.txt +59 -0
- data/doc/ja/filter/antirefspam.txt +86 -0
- data/doc/ja/filter/comment_key.ja.html +182 -0
- data/doc/ja/filter/spambayes.txt +3 -0
- data/doc/ja/plugin/add_bookmark.txt +50 -0
- data/doc/ja/plugin/category_to_tag.txt +21 -0
- data/doc/ja/plugin/cocoment.txt +31 -0
- data/doc/ja/plugin/google_adsense.txt +25 -0
- data/doc/ja/plugin/google_analytics.txt +7 -0
- data/doc/ja/plugin/image_detail.txt +69 -0
- data/doc/ja/plugin/image_gps.txt +36 -0
- data/doc/ja/plugin/image_gps2.txt +41 -0
- data/doc/ja/plugin/livedoor_weather.txt +105 -0
- data/doc/ja/plugin/opensearch_ad.txt +16 -0
- data/doc/ja/plugin/section_footer.txt +84 -0
- data/doc/ja/plugin/select_theme.txt +1 -0
- data/doc/ja/plugin.txt +13 -0
- data/doc/ja/style/hatena.txt +10 -0
- data/doc/ja/style/markdown.txt +13 -0
- data/doc/ja/util.txt +12 -0
- data/filter/antirefspam.rb +263 -0
- data/filter/commentkey.rb +29 -0
- data/filter/commentsize.rb +18 -0
- data/filter/hidecomment.rb +13 -0
- data/filter/iplookup.rb +55 -0
- data/filter/plugin/antirefspam.rb +59 -0
- data/filter/plugin/commentkey.rb +58 -0
- data/filter/plugin/commentsize.rb +12 -0
- data/filter/plugin/en/iplookup.rb +9 -0
- data/filter/plugin/en/spambayes.rb +123 -0
- data/filter/plugin/iplookup.rb +39 -0
- data/filter/plugin/ja/antirefspam.rb +91 -0
- data/filter/plugin/ja/commentkey.rb +17 -0
- data/filter/plugin/ja/commentsize.rb +6 -0
- data/filter/plugin/ja/iplookup.rb +9 -0
- data/filter/plugin/ja/spambayes.rb +124 -0
- data/filter/plugin/spambayes.rb +501 -0
- data/filter/plugin/zh/iplookup.rb +9 -0
- data/filter/rblcheck.rb +36 -0
- data/filter/spambayes.rb +535 -0
- data/filter/spamlookup.rb +37 -0
- data/io/dbi_io/ChangeLog +19 -0
- data/io/dbi_io/README.ja +39 -0
- data/io/dbi_io/dbi_io.rb +181 -0
- data/io/dbi_io/plugin/refererDbiIO.rb +76 -0
- data/io/dbi_io/tdiary_table.sql +42 -0
- data/js/appstore.js +109 -0
- data/js/datepicker.js +69 -0
- data/js/editor.js +82 -0
- data/js/flickr.js +157 -0
- data/js/image_ex.js +79 -0
- data/js/jquery.socialbutton.js +842 -0
- data/js/nicovideo.js +17 -0
- data/js/picasa.js +322 -0
- data/js/plugin_checker.js +71 -0
- data/js/prettify/lang-apollo.js +2 -0
- data/js/prettify/lang-clj.js +18 -0
- data/js/prettify/lang-css.js +2 -0
- data/js/prettify/lang-go.js +1 -0
- data/js/prettify/lang-hs.js +2 -0
- data/js/prettify/lang-lisp.js +3 -0
- data/js/prettify/lang-lua.js +2 -0
- data/js/prettify/lang-ml.js +2 -0
- data/js/prettify/lang-n.js +4 -0
- data/js/prettify/lang-proto.js +1 -0
- data/js/prettify/lang-scala.js +2 -0
- data/js/prettify/lang-sql.js +2 -0
- data/js/prettify/lang-tex.js +1 -0
- data/js/prettify/lang-vb.js +2 -0
- data/js/prettify/lang-vhdl.js +3 -0
- data/js/prettify/lang-wiki.js +2 -0
- data/js/prettify/lang-xq.js +3 -0
- data/js/prettify/lang-yaml.js +2 -0
- data/js/prettify/prettify.css +1 -0
- data/js/prettify/prettify.js +28 -0
- data/js/referer.js +17 -0
- data/js/show_and_hide.js +39 -0
- data/js/socialbutton.js +126 -0
- data/js/twitter_anywhere.js +28 -0
- data/js/yahoo_kousei.js +21 -0
- data/lib/bayes/convert.rb +34 -0
- data/lib/bayes.rb +232 -0
- data/lib/exifparser/BUGS +1 -0
- data/lib/exifparser/ChangeLog +169 -0
- data/lib/exifparser/README +15 -0
- data/lib/exifparser/install.rb +1015 -0
- data/lib/exifparser/lib/exifparser/makernote/canon.rb +502 -0
- data/lib/exifparser/lib/exifparser/makernote/fujifilm.rb +415 -0
- data/lib/exifparser/lib/exifparser/makernote/minolta.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/mk_nikonflensname.rb +39 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon.rb +267 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon2.rb +581 -0
- data/lib/exifparser/lib/exifparser/makernote/nikonflensname.rb +438 -0
- data/lib/exifparser/lib/exifparser/makernote/olympus.rb +225 -0
- data/lib/exifparser/lib/exifparser/makernote/prove.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/sigma.rb +237 -0
- data/lib/exifparser/lib/exifparser/pre-setup.rb +1 -0
- data/lib/exifparser/lib/exifparser/scan.rb +278 -0
- data/lib/exifparser/lib/exifparser/tag.rb +2298 -0
- data/lib/exifparser/lib/exifparser/thumbnail.rb +76 -0
- data/lib/exifparser/lib/exifparser/utils.rb +88 -0
- data/lib/exifparser/lib/exifparser.rb +265 -0
- data/lib/exifparser/sample/exifview.rb +279 -0
- data/lib/tdiary-contrib.rb +19 -0
- data/lib/wgs2tky.rb +93 -0
- data/misc/section_footer2/buzzurl.yaml +6 -0
- data/misc/section_footer2/fc2.yaml +6 -0
- data/misc/section_footer2/ldc.yaml +6 -0
- data/misc/section_footer2/retweet.yaml +7 -0
- data/misc/section_footer2/twitter.yaml +7 -0
- data/misc/section_footer2/yahoo.yaml +6 -0
- data/misc/tdiarygraph/tdiarygraph120x90e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph125x125e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph240x180e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph468x60e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph728x90e.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r7.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125s.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes234x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes468x30.swf +0 -0
- data/plugin/add_bookmark.rb +89 -0
- data/plugin/apple_webclip.rb +26 -0
- data/plugin/appstore.rb +47 -0
- data/plugin/bigpresen.rb +86 -0
- data/plugin/bitly.rb +39 -0
- data/plugin/bootstrap-navi.rb +54 -0
- data/plugin/canonical.rb +9 -0
- data/plugin/category_similar.rb +73 -0
- data/plugin/category_to_tag.rb +60 -0
- data/plugin/category_to_tagcloud.rb +172 -0
- data/plugin/cocomment.rb +37 -0
- data/plugin/code-prettify.rb +23 -0
- data/plugin/coderwall.rb +34 -0
- data/plugin/datepicker.rb +28 -0
- data/plugin/day2section.rb +20 -0
- data/plugin/del_footer.rb +111 -0
- data/plugin/description_from_body.rb +23 -0
- data/plugin/development.rb +16 -0
- data/plugin/editor.rb +11 -0
- data/plugin/en/add_bookmark.rb +20 -0
- data/plugin/en/del_footer.rb +10 -0
- data/plugin/en/git-register.rb +3 -0
- data/plugin/en/livedoor_weather.rb +25 -0
- data/plugin/en/microsummary.rb +18 -0
- data/plugin/en/nicovideo.rb +38 -0
- data/plugin/en/openid.rb +8 -0
- data/plugin/en/section_footer.rb +6 -0
- data/plugin/en/section_footer2.rb +3 -0
- data/plugin/en/socialbutton.rb +5 -0
- data/plugin/everytrail.rb +39 -0
- data/plugin/facebook_comments.rb +59 -0
- data/plugin/flickr.rb +209 -0
- data/plugin/gist.rb +16 -0
- data/plugin/git-register.rb +240 -0
- data/plugin/github_badge.rb +27 -0
- data/plugin/github_link.rb +9 -0
- data/plugin/goo_gl.rb +42 -0
- data/plugin/google_adsense.rb +132 -0
- data/plugin/google_analytics.rb +39 -0
- data/plugin/google_map.rb +168 -0
- data/plugin/google_sitemaps.rb +60 -0
- data/plugin/google_webmaster.rb +22 -0
- data/plugin/hatena_bookmark_nocomment.rb +9 -0
- data/plugin/hatena_star.rb +66 -0
- data/plugin/hb_footer.rb +255 -0
- data/plugin/hb_footer4sec.rb +244 -0
- data/plugin/hb_footer4sec_js.rb +30 -0
- data/plugin/hide_comment_form.rb +4 -0
- data/plugin/hide_sidebar_iphone.rb +21 -0
- data/plugin/iddy.rb +81 -0
- data/plugin/image_detail.rb +143 -0
- data/plugin/image_ex.rb +462 -0
- data/plugin/image_gps.rb +128 -0
- data/plugin/inline_wiki.rb +6 -0
- data/plugin/instagr.rb +64 -0
- data/plugin/ja/add_bookmark.rb +20 -0
- data/plugin/ja/del_footer.rb +10 -0
- data/plugin/ja/flickr.rb +62 -0
- data/plugin/ja/git-register.rb +3 -0
- data/plugin/ja/google_sitemaps.rb +35 -0
- data/plugin/ja/livedoor_weather.rb +25 -0
- data/plugin/ja/microsummary.rb +18 -0
- data/plugin/ja/nicovideo.rb +41 -0
- data/plugin/ja/openid.rb +7 -0
- data/plugin/ja/section_footer.rb +6 -0
- data/plugin/ja/section_footer2.rb +4 -0
- data/plugin/ja/socialbutton.rb +6 -0
- data/plugin/jdate.rb +20 -0
- data/plugin/jholiday.rb +16 -0
- data/plugin/jmonth.rb +20 -0
- data/plugin/jquery_ui_theme.rb +55 -0
- data/plugin/jroku.rb +28 -0
- data/plugin/jyear.rb +37 -0
- data/plugin/latlonglab_route.rb +25 -0
- data/plugin/lazy_referer.rb +38 -0
- data/plugin/livedoor_weather.rb +180 -0
- data/plugin/make_link.rb +44 -0
- data/plugin/makerss_category.rb +43 -0
- data/plugin/makerss_comment.rb +35 -0
- data/plugin/microsummary.rb +62 -0
- data/plugin/mm_footer.rb +215 -0
- data/plugin/monthly_autopagerize.rb +67 -0
- data/plugin/my_hotentry.rb +132 -0
- data/plugin/navi_day.rb +118 -0
- data/plugin/navi_this_month.rb +15 -0
- data/plugin/nicovideo.rb +115 -0
- data/plugin/notify_miniblog.rb +134 -0
- data/plugin/ogp.rb +55 -0
- data/plugin/ohmsha_estore.rb +71 -0
- data/plugin/openid.rb +90 -0
- data/plugin/opensearch_ad.rb +33 -0
- data/plugin/picasa.rb +56 -0
- data/plugin/plugin_checker.rb +41 -0
- data/plugin/popit.rb +22 -0
- data/plugin/prettify.rb +19 -0
- data/plugin/prezi.rb +10 -0
- data/plugin/profile.rb +222 -0
- data/plugin/puboo.rb +93 -0
- data/plugin/pygments_css.rb +76 -0
- data/plugin/rating.rb +419 -0
- data/plugin/recent_estraier.rb +50 -0
- data/plugin/recent_tweet.rb +71 -0
- data/plugin/retweet.rb +86 -0
- data/plugin/rubykaigi.rb +99 -0
- data/plugin/search-bing.rb +87 -0
- data/plugin/search-default.rb +264 -0
- data/plugin/search-google-custom.rb +60 -0
- data/plugin/search-yahoo-websearch.rb +121 -0
- data/plugin/search-yahoo.rb +109 -0
- data/plugin/section_footer.rb +195 -0
- data/plugin/section_footer2.rb +278 -0
- data/plugin/section_permalink.rb +73 -0
- data/plugin/section_permalink_anchor.rb +39 -0
- data/plugin/select_style.rb +42 -0
- data/plugin/select_theme.rb +90 -0
- data/plugin/show_and_hide.rb +77 -0
- data/plugin/slideshare.rb +10 -0
- data/plugin/socialbutton.rb +60 -0
- data/plugin/tatsu_zine.rb +93 -0
- data/plugin/tdiarygraph_flashstyle.rb +296 -0
- data/plugin/tdiarytimes.rb +166 -0
- data/plugin/tdiarytimes2.rb +406 -0
- data/plugin/tdiarytimes_flashstyle.rb +263 -0
- data/plugin/tdiarytimes_textstyle.rb +290 -0
- data/plugin/title_anchor.rb +16 -0
- data/plugin/tweet_quote.rb +106 -0
- data/plugin/twitpic.rb +10 -0
- data/plugin/twitter.rb +46 -0
- data/plugin/twitter_anywhere.rb +209 -0
- data/plugin/twitter_badge.rb +42 -0
- data/plugin/twitter_js.rb +59 -0
- data/plugin/ustream.rb +19 -0
- data/plugin/vimeo.rb +14 -0
- data/plugin/volatile.rb +89 -0
- data/plugin/vote.rb +100 -0
- data/plugin/wikiloc.rb +27 -0
- data/plugin/windex.rb +512 -0
- data/plugin/yahoo_kousei.rb +79 -0
- data/plugin/yahoo_map.rb +97 -0
- data/plugin/youtube.rb +33 -0
- data/plugin/yshop.rb +189 -0
- data/plugin/zenback.rb +46 -0
- data/spec/apple_webclip_spec.rb +46 -0
- data/spec/fixtures/friendfeed.xml +2 -0
- data/spec/fixtures/github.json +1 -0
- data/spec/fixtures/twitter.xml +73 -0
- data/spec/gist_spec.rb +16 -0
- data/spec/github_link_spec.rb +39 -0
- data/spec/google_analytics_spec.rb +60 -0
- data/spec/jdate_spec.rb +23 -0
- data/spec/jmonth_spec.rb +28 -0
- data/spec/jyear_spec.rb +21 -0
- data/spec/my_hotentry_spec.rb +78 -0
- data/spec/openid_spec.rb +246 -0
- data/spec/opensearch_ad_spec.rb +50 -0
- data/spec/profile_spec.rb +88 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec_helper.rb +223 -0
- data/spec/title_anchor_spec.rb +39 -0
- data/spec/twitter_js_spec.rb +116 -0
- data/spec/youtube_spec.rb +20 -0
- data/style/hatena_style.rb +1011 -0
- data/style/markdown_style.rb +239 -0
- data/style/wikiext_style.rb +21 -0
- data/tdiary-contrib.gemspec +25 -0
- data/util/clean-spam/README.ja +1 -0
- data/util/clean-spam/tdiary-comment-clean +46 -0
- data/util/clean-spam/tdiary-comment-clean2 +81 -0
- data/util/clean-spam/tdiary-referer-clean +46 -0
- data/util/convert_pstore.rb +82 -0
- data/util/estraier-search/ChangeLog +36 -0
- data/util/estraier-search/README.ja +114 -0
- data/util/estraier-search/en/estraier-register.rb +3 -0
- data/util/estraier-search/estraier-register.rb +298 -0
- data/util/estraier-search/estraier-search.rb +273 -0
- data/util/estraier-search/estraier.rhtml +73 -0
- data/util/estraier-search/estraier.rxml +23 -0
- data/util/estraier-search/i.estraier.rhtml +31 -0
- data/util/estraier-search/ja/estraier-register.rb +3 -0
- data/util/image-gallery/README.ja +27 -0
- data/util/image-gallery/image-gallery.rb +523 -0
- data/util/image-gallery/image-gallery.rb.euc-jp +523 -0
- data/util/image-gallery/js/SmoothGallery/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/css/ReMooz.css +186 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/loading-bar-black.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_e.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_n.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_ne.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_nw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_s.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_se.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_sw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_w.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/spinner.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/jd.gallery.css +371 -0
- data/util/image-gallery/js/SmoothGallery/css/layout.css +91 -0
- data/util/image-gallery/js/SmoothGallery/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/resizer.php +113 -0
- data/util/image-gallery/js/SmoothGallery/scripts/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.Routing.js +126 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.js +109 -0
- data/util/image-gallery/js/SmoothGallery/scripts/ReMooz.js +364 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.js +843 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.set.js +183 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.transitions.js +90 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jdgalleryresize.js +828 -0
- data/util/image-gallery/js/SmoothGallery/scripts/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2-more.js +103 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2.1-core-yc.js +349 -0
- data/util/image-gallery/js/SmoothGallery/scripts/resizer.php +113 -0
- data/util/image-gallery/misc/plugin/recent_image.rb +406 -0
- data/util/image-gallery/skel/gallery.rhtml +154 -0
- data/util/image-gallery/skel/gallery.rhtml.euc-jp +154 -0
- data/util/image-gallery/tdiary.conf.igsample +8 -0
- data/util/image-gallery/theme/image-gallery.css +85 -0
- data/util/image2flickr.rb +282 -0
- data/util/posttdiary/README.ja +12 -0
- data/util/posttdiary/posttdiary-ex.rb +1155 -0
- data/util/posttdiary/posttdiary.rb +245 -0
- data/util/rast-search/ChangeLog +55 -0
- data/util/rast-search/README.ja +99 -0
- data/util/rast-search/en/rast-register.rb +3 -0
- data/util/rast-search/i.rast.rhtml +33 -0
- data/util/rast-search/ja/rast-register.rb +3 -0
- data/util/rast-search/rast-register.rb +326 -0
- data/util/rast-search/rast-search.rb +249 -0
- data/util/rast-search/rast.rhtml +66 -0
- data/util/rast-search/rast.rxml +21 -0
- data/util/section_link/README +11 -0
- data/util/section_link/misc/plugin/section_link.rb +68 -0
- data/util/section_link/misc/plugin/section_link_anchor.rb +38 -0
- data/util/section_link/tdiary/tdiary_day_ext.rb +21 -0
- data/util/section_link/tdiary/tdiaryext_style.rb +36 -0
- data/util/section_link/tdiary/wikiext_style.rb +36 -0
- data/util/tdiary-for-ruby1.9/compatible.rb +97 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch +98 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.3.1.patch +212 -0
- data/util/tdiary-grep/README +4 -0
- data/util/tdiary-grep/grep.rb +445 -0
- data/util/tdiary-mode/http.el +130 -0
- data/util/tdiary-mode/tdiary-mode.el +613 -0
- data/util/tdiary-vim/ChangeLog +25 -0
- data/util/tdiary-vim/README +60 -0
- data/util/tdiary-vim/tdiary.vim +350 -0
- data/util/tdiarysearch/README.en +53 -0
- data/util/tdiarysearch/README.ja +99 -0
- data/util/tdiarysearch/search.rb +504 -0
- metadata +497 -0
@@ -0,0 +1,143 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# image_gps.rb $Revision: 1.1 $
|
3
|
+
#
|
4
|
+
# 概要:
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# 使い方:
|
8
|
+
# 絵日記Plugin(image.rb)とおなじ
|
9
|
+
#
|
10
|
+
# Copyright (c) 2009,2010 kp <kp@mmho.no-ip.org>
|
11
|
+
# Distributed under the GPL
|
12
|
+
#
|
13
|
+
|
14
|
+
=begin ChangeLog
|
15
|
+
2010-04-21 kp
|
16
|
+
* スマートフォン対応
|
17
|
+
* Google Maps API Keyが設定されていない場合はStaticMAPを生成しない
|
18
|
+
* リンク先をGoogle Mapsに統一
|
19
|
+
2009-06-03 kp
|
20
|
+
* first version
|
21
|
+
* fork from image_gps2.rb
|
22
|
+
=end
|
23
|
+
|
24
|
+
require 'exifparser'
|
25
|
+
|
26
|
+
def tky2wgs lat,lon
|
27
|
+
lat_w = lat - lat*0.00010695 + lon*0.000017464 + 0.0046017
|
28
|
+
lon_w = lon - lat*0.000046038 - lon*0.000083043 + 0.010040
|
29
|
+
lat = lat_w
|
30
|
+
lon = lon_w
|
31
|
+
return lat,lon
|
32
|
+
end
|
33
|
+
|
34
|
+
def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
|
35
|
+
if @conf.secure then
|
36
|
+
image = "#{@image_date}_#{id}.jpg"
|
37
|
+
image_t = "#{@image_date}_#{thumbnail}.jpg" if thumbnail
|
38
|
+
else
|
39
|
+
image = image_list( @image_date )[id.to_i]
|
40
|
+
image_t = image_list( @image_date )[thumbnail.to_i] if thumbnail
|
41
|
+
end
|
42
|
+
if size then
|
43
|
+
if size.kind_of?(Array)
|
44
|
+
size = %Q[ width="#{size[0]}" height="#{size[1]}"]
|
45
|
+
else
|
46
|
+
size = %Q[ width="#{size.to_i}"]
|
47
|
+
end
|
48
|
+
else
|
49
|
+
size = ""
|
50
|
+
end
|
51
|
+
|
52
|
+
exif = ExifParser.new("#{@image_dir}/#{image}".untaint) rescue nil
|
53
|
+
|
54
|
+
google = "http://maps.google.co.jp"
|
55
|
+
|
56
|
+
if exif
|
57
|
+
#GPS Info
|
58
|
+
begin
|
59
|
+
lat = exif['GPSLatitude'].value
|
60
|
+
lat = lat[0].to_f + lat[1].to_f/60 + lat[2].to_f/3600
|
61
|
+
lat = -lat if exif['GPSLatitudeRef'].value == 'S'
|
62
|
+
lon = exif['GPSLongitude'].value
|
63
|
+
lon = lon[0].to_f + lon[1].to_f/60 + lon[2].to_f/3600
|
64
|
+
lon = -lon if exif['GPSLongitudeRef'].value == 'W'
|
65
|
+
datum = exif['GPSMapDatum'].value if exif.tag?('GPSMapDatum')
|
66
|
+
lat,lon = tky2wgs(lat,lon) if datum == 'TOKYO'
|
67
|
+
rescue
|
68
|
+
lat = nil
|
69
|
+
end
|
70
|
+
detail = "<ul>"
|
71
|
+
detail += "<li>#{exif['Model'].to_s}" if exif.tag?('Model')
|
72
|
+
detail += "<li>焦点距離:#{exif['FocalLength'].to_s}" if exif.tag?('FocalLength')
|
73
|
+
detail += "<li>F値:#{exif['FNumber'].to_s}" if exif.tag?('FNumber')
|
74
|
+
detail += "<li>露出時間:#{exif['ExposureTime'].to_s}" if exif.tag?('ExposureTime')
|
75
|
+
detail += "<li>露出補正:#{exif['ExposureBiasValue'].to_s}" if exif.tag?('ExposureBiasValue')
|
76
|
+
unless lat.nil?
|
77
|
+
unless (@conf['image_gps.google_maps_api_key'] == '' || @conf.smartphone?)
|
78
|
+
img_map = %Q["http://maps.google.com/staticmap?format=gif&]
|
79
|
+
img_map += %Q[center=#{lat},#{lon}&zoom=14&size=200x200&markers=#{lat},#{lon}&]
|
80
|
+
img_map += %Q[key=#{@conf['image_gps.google_maps_api_key']}&sensor=false"]
|
81
|
+
end
|
82
|
+
map_link = %Q[<a href="#{google}/maps?q=#{lat},#{lon}">]
|
83
|
+
map_link += "#{exif['GPSLatitude'].to_s},#{exif['GPSLatitudeRef'].value}"
|
84
|
+
map_link += " #{exif['GPSLongitude'].to_s},#{exif['GPSLongitudeRef'].value}"
|
85
|
+
map_link += %Q[<img class="map" src=#{img_map}>] if img_map
|
86
|
+
map_link += "</a>"
|
87
|
+
detail += "<li>"+map_link
|
88
|
+
end
|
89
|
+
detail += "</ul>"
|
90
|
+
end
|
91
|
+
|
92
|
+
img = %Q[<img class="#{place}" src="#{@image_url}/#{image}" alt="#{alt}" title="#{alt}" #{size}>]
|
93
|
+
img_t = %Q[<img class="#{place}" src="#{@image_url}/#{image_t}" alt="#{alt}" title="#{alt}" #{size}>]
|
94
|
+
|
95
|
+
url = ''
|
96
|
+
if @conf.mobile_agent?
|
97
|
+
url += %Q[<a href=#{google}/maps/m?q=#{lat},#{lon}>] unless lat.nil?
|
98
|
+
url += thumbnail ? img_t : img
|
99
|
+
url += %Q[</a>] unless lat.nil?
|
100
|
+
else
|
101
|
+
url += %Q[<div class="photo_detail"><p>#{alt}</p>] if detail
|
102
|
+
url += %Q[<a href="#{@image_url}/#{image}">]
|
103
|
+
url += thumbnail ? img_t : img
|
104
|
+
url +=%Q[</a>]
|
105
|
+
url += %Q[#{detail}</div>] if detail
|
106
|
+
end
|
107
|
+
url
|
108
|
+
end
|
109
|
+
add_header_proc do
|
110
|
+
if @mode !~ /conf$/ and not bot? then
|
111
|
+
<<-HTML
|
112
|
+
<style type="text/css"><!--
|
113
|
+
img.map{
|
114
|
+
display:none;
|
115
|
+
position:absolute;
|
116
|
+
border:none;
|
117
|
+
}
|
118
|
+
a:hover img.map{
|
119
|
+
display:inline;
|
120
|
+
}
|
121
|
+
--></style>
|
122
|
+
HTML
|
123
|
+
else
|
124
|
+
''
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
add_conf_proc('image_gps','image_gpsの設定','etc') do
|
129
|
+
if @mode == 'saveconf' then
|
130
|
+
@conf['image_gps.add_info'] = @cgi.params['image_gps.add_info'][0]
|
131
|
+
@conf['image_gps.google_maps_api_key'] = @cgi.params['image_gps.google_maps_api_key'][0]
|
132
|
+
end
|
133
|
+
|
134
|
+
<<-HTML
|
135
|
+
<p>
|
136
|
+
<h3>撮影条件の表示</h3>
|
137
|
+
<input type="checkbox" name="image_gps.add_info" value="true" #{if @conf['image_gps.add_info'] then " checked" end}>タイトルに撮影条件を追加する
|
138
|
+
<h3>Google Maps API Key</h3>
|
139
|
+
<input type="text" name="image_gps.google_maps_api_key" value="#{@conf['image_gps.google_maps_api_key']}">
|
140
|
+
</p>
|
141
|
+
HTML
|
142
|
+
|
143
|
+
end
|
data/plugin/image_ex.rb
ADDED
@@ -0,0 +1,462 @@
|
|
1
|
+
# image_plugin_ex.rb
|
2
|
+
# version 0.3
|
3
|
+
# -pv-
|
4
|
+
#
|
5
|
+
# 名称:
|
6
|
+
# 絵日記Plugin機能追加版
|
7
|
+
#
|
8
|
+
# 概要:
|
9
|
+
# 日記更新画面からの画像アップロード、サムネイル作成、本文への表示
|
10
|
+
#
|
11
|
+
# 使う場所:
|
12
|
+
# 本文
|
13
|
+
#
|
14
|
+
# 使い方:
|
15
|
+
# image( number, 'altword', thumbnail ) - 画像を表示します。
|
16
|
+
# number - 画像の番号0、1、2等
|
17
|
+
# altword - imgタグの altに入れる文字列
|
18
|
+
# thumbnail - サムネイル(小さな画像)を指定する(省略可)
|
19
|
+
#
|
20
|
+
# image_left( number, 'altword', thumbnail ) - imageにclass=leftを追加します。
|
21
|
+
# image_right( number, 'altword', thumbnail ) - imageにclass=rightを追加します。
|
22
|
+
#
|
23
|
+
# image_link( number, 'desc' ) - 画像へのリンクを生成します。
|
24
|
+
# number - 画像の番号0、1、2等
|
25
|
+
# desc - 画像の説明
|
26
|
+
#
|
27
|
+
# その他:
|
28
|
+
# tDiary version 1.5.4以降で動作します。
|
29
|
+
# tdiary.confで、
|
30
|
+
# 画像ファイルを保存するディレクトリ
|
31
|
+
# @options['image.dir']
|
32
|
+
# 画像ファイルのURL
|
33
|
+
# @options['image.url']
|
34
|
+
# 縮小画像の生成方法
|
35
|
+
# @options['image.url']
|
36
|
+
# 0 - 縮小画像を生成しない
|
37
|
+
# 1 - ImageMagickのconvertで縮小画王を生成
|
38
|
+
# 2 - netpbm群で縮小画王を生成
|
39
|
+
# を設定してください。
|
40
|
+
# また、@secure = trueな環境では動作しません。
|
41
|
+
#
|
42
|
+
# 詳しくは、
|
43
|
+
# http://shimoi.s26.xrea.com/hiki/hiki.xcg?TdiaryEnikkiEx
|
44
|
+
# をご覧下さい。
|
45
|
+
#
|
46
|
+
# ライセンスについて:
|
47
|
+
# Copyright (c) 2002 Daisuke Kato <dai@kato-agri.com>
|
48
|
+
# Copyright (c) 2002 Toshi Okada <toshi@neverland.to>
|
49
|
+
# Copyright (c) 2003 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
50
|
+
#
|
51
|
+
# You can redistribute it and/or modify it under GPL2.
|
52
|
+
#
|
53
|
+
=begin Changelog
|
54
|
+
2003-05-16 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
55
|
+
* method 'image' is extended to show a thumbnail.
|
56
|
+
* new method: 'image_link'.
|
57
|
+
* version 0.3
|
58
|
+
|
59
|
+
2003-05-16 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
60
|
+
* modify illegal option names.
|
61
|
+
* version 0.2.
|
62
|
+
|
63
|
+
2003-05-16 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
64
|
+
* support manual upload of thumbnail when useresize == 0
|
65
|
+
|
66
|
+
2003-04-27 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
67
|
+
* link element is removed when no thumbnail.
|
68
|
+
|
69
|
+
2003-04-25 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
70
|
+
* add JavaScript for insert plugin tag into diary.
|
71
|
+
* upload/delete form style changed.
|
72
|
+
|
73
|
+
2003-04-24 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
74
|
+
* upload/delete form style changed.
|
75
|
+
|
76
|
+
2003-04-22 Yoshimi KURUMA <yoshimik@iris.dti.ne.jp>
|
77
|
+
* version 0.1 first form_proc version.
|
78
|
+
=end
|
79
|
+
|
80
|
+
@image_dir = @options && @options['image.dir'] || './images/'
|
81
|
+
@image_dir.chop! if /\/$/ =~ @image_dir
|
82
|
+
@image_url = @options && @options['image.url'] || './images/'
|
83
|
+
@image_url.chop! if /\/$/ =~ @image_url
|
84
|
+
@imageex_thumbnailsize = @options && @options['image_ex.previewsize'] || 120
|
85
|
+
@imageex_yearlydir = @options && @options['image_ex.yearlydir'] || 0
|
86
|
+
|
87
|
+
if @conf.smartphone?
|
88
|
+
enable_js("image_ex.js")
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
add_body_enter_proc(Proc.new do |date|
|
93
|
+
@image_date = date.strftime("%Y%m%d")
|
94
|
+
@image_year = date.strftime("%Y")
|
95
|
+
""
|
96
|
+
end)
|
97
|
+
|
98
|
+
|
99
|
+
def image( id, alt = "image", id2 = nil, width = nil, place="none" )
|
100
|
+
@image_date ||= @date.strftime("%Y%m%d")
|
101
|
+
@image_year ||= @date.strftime("%Y")
|
102
|
+
|
103
|
+
if @imageex_yearlydir == 1
|
104
|
+
image_url = %Q[#{@image_url}/#{@image_year}/]
|
105
|
+
image_dir = %Q[#{@image_dir}/#{@image_year}/]
|
106
|
+
else
|
107
|
+
image_url = %Q[#{@image_url}/]
|
108
|
+
image_dir = %Q[#{@image_dir}/]
|
109
|
+
end
|
110
|
+
|
111
|
+
image_dir.untaint
|
112
|
+
Dir.mkdir(image_dir) unless File.directory?(image_dir)
|
113
|
+
|
114
|
+
list = imageList(@image_date, image_dir).untaint
|
115
|
+
slist = imageList(@image_date, image_dir, "s").untaint
|
116
|
+
|
117
|
+
if width
|
118
|
+
width_tag = %Q[width="#{h width}"]
|
119
|
+
else
|
120
|
+
width_tag = ""
|
121
|
+
end
|
122
|
+
|
123
|
+
if id2
|
124
|
+
%Q[<a href="#{h image_url}#{h list[id.to_i]}"><img class="image-ex #{h place}" src="#{h image_url}#{h list[id2.to_i]}" alt="#{h alt}"></a>]
|
125
|
+
else
|
126
|
+
if slist[id.to_i]
|
127
|
+
%Q[<a href="#{h image_url}#{h list[id.to_i]}"><img src="#{h image_url}#{h slist[id.to_i]}" alt="#{h alt}" title="#{h alt}" #{width_tag} class="image-ex #{h place}"></a>]
|
128
|
+
else
|
129
|
+
if list[id.to_i]
|
130
|
+
# %Q[<a href="#{h image_url}#{h list[id.to_i]}"><img src="#{h image_url}#{h list[id.to_i]}" alt="#{h alt}" #{width_tag} class="image-ex #{h place}"></a>]
|
131
|
+
%Q[<img src="#{h image_url}#{h list[id.to_i]}" alt="#{h alt}" title="#{h alt}" #{width_tag} class="image-ex #{h place}">]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def image_left( id, alt = "image", id2 = nil, width=nil )
|
138
|
+
image( id, alt, id2, width, "left" )
|
139
|
+
end
|
140
|
+
|
141
|
+
def image_right( id, alt = "image", id2 = nil, width=nil )
|
142
|
+
image( id, alt, id2, width, "right" )
|
143
|
+
end
|
144
|
+
|
145
|
+
def image_link( id, str )
|
146
|
+
@image_date ||= @date.strftime("%Y%m%d")
|
147
|
+
@image_year ||= @date.strftime("%Y")
|
148
|
+
if @imageex_yearlydir == 1
|
149
|
+
image_url = %Q[#{@image_url}/#{@image_year}/]
|
150
|
+
image_dir = %Q[#{@image_dir}/#{@image_year}/]
|
151
|
+
else
|
152
|
+
image_url = %Q[#{@image_url}/]
|
153
|
+
image_dir = %Q[#{@image_dir}/]
|
154
|
+
end
|
155
|
+
list = imageList(@image_date, image_dir).untaint
|
156
|
+
%Q[<a href="#{h image_url}#{h list[id.to_i]}">#{str}</a>]
|
157
|
+
end
|
158
|
+
|
159
|
+
###
|
160
|
+
|
161
|
+
def imageList(date, image_dir='@image_dir', prefix="")
|
162
|
+
date = "#{prefix}"+date
|
163
|
+
image_path = []
|
164
|
+
Dir.foreach(image_dir){ |file|
|
165
|
+
if file =~ /(.*)\_(.*)\.(.*)/
|
166
|
+
if $1 == date
|
167
|
+
image_path[$2.to_i] = file
|
168
|
+
end
|
169
|
+
end
|
170
|
+
}
|
171
|
+
image_path
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
add_form_proc do |date|
|
176
|
+
begin
|
177
|
+
# ENV['PATH'] = nil
|
178
|
+
|
179
|
+
imageex_useresize = @options && @options['image_ex.useresize'] || 0
|
180
|
+
imageex_converttype = @options && @options['image_ex.converttype'] || 0
|
181
|
+
imageex_thresholdsize = @options && @options['image_ex.thresholdsize'] || 160
|
182
|
+
imageex_convertedwidth = @options && @options['image_ex.convertedwidth'] || 160
|
183
|
+
imageex_convertedheight = @options && @options['image_ex.convertedheight'] || 120
|
184
|
+
|
185
|
+
if imageex_useresize == 1 || imageex_useresize ==2
|
186
|
+
begin
|
187
|
+
require 'image_size.rb'
|
188
|
+
rescue LoadError
|
189
|
+
imageex_useresize = 0
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
if imageex_useresize == 1
|
194
|
+
def resize_image(orig, new, width, height, imageex_convertedwidth, imageex_convertedheight, orig_type, new_type)
|
195
|
+
imageex_convertpath = @options && @options['image_ex.convertpath'] || "convert"
|
196
|
+
imageex_convertpath
|
197
|
+
|
198
|
+
if width > height
|
199
|
+
imageex_convertedsize = %Q[#{imageex_convertedwidth}x#{imageex_convertedheight}]
|
200
|
+
imageex_convertedsize
|
201
|
+
else
|
202
|
+
imageex_convertedsize = %Q[#{imageex_convertedheight}x#{imageex_convertedwidth}]
|
203
|
+
imageex_convertedsize
|
204
|
+
end
|
205
|
+
system(imageex_convertpath , "-geometry", imageex_convertedsize , orig, new)
|
206
|
+
if FileTest::size?( new ) == 0
|
207
|
+
File::delete( new )
|
208
|
+
end
|
209
|
+
end
|
210
|
+
elsif imageex_useresize == 2
|
211
|
+
def resize_image(orig, new, width, height, imageex_convertedwidth, imageex_convertedheight, orig_type, new_type)
|
212
|
+
pnmscale = @options && @options['image_ex.pnmscalepath'] || "pnmscale"
|
213
|
+
jpegtopnm = @options && @options['image_ex.jpegtopnmpath'] || "jpegtopnm"
|
214
|
+
pnmtojpeg = @options && @options['image_ex.pnmtojpegpath'] || "pnmtojpeg"
|
215
|
+
pngtopnm = @options && @options['image_ex.pngtopnmpath'] || "pngtopnm"
|
216
|
+
pnmtopng = @options && @options['image_ex.pnmtopngpath'] || "pnmtopng"
|
217
|
+
giftopnm = @options && @options['image_ex.giftopnmpath'] || "giftopnm"
|
218
|
+
tifftopnm = @options && @options['image_ex.tifftopnmpath'] || "tifftopnm"
|
219
|
+
bmptopnm = @options && @options['image_ex.bmptopnmpath'] || "bmptopnm"
|
220
|
+
|
221
|
+
downtype = orig_type.downcase
|
222
|
+
topnm = eval("#{downtype}topnm")
|
223
|
+
|
224
|
+
if new_type == "jpg"
|
225
|
+
pnmto = pnmtojpeg
|
226
|
+
elsif new_type == "png"
|
227
|
+
pnmto = pnmtopng
|
228
|
+
end
|
229
|
+
|
230
|
+
if width > height
|
231
|
+
imageex_convertedsize ="#{imageex_convertedwidth}"
|
232
|
+
else
|
233
|
+
imageex_convertedsize ="#{imageex_convertedheight}"
|
234
|
+
end
|
235
|
+
com_line =%Q[#{topnm} #{orig} | #{pnmscale} --width #{imageex_convertedsize} | #{pnmto} > #{new}]
|
236
|
+
system( com_line )
|
237
|
+
if FileTest::size?( new ) == 0
|
238
|
+
File::delete( new )
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def dayimagelist( image_dir, image_date, prefix="")
|
244
|
+
image_path = []
|
245
|
+
image_dir.untaint
|
246
|
+
Dir.foreach(image_dir){ |file|
|
247
|
+
if file=~ /(.*)\_(.*)\.(.*)/
|
248
|
+
if $1 == "#{prefix}" + image_date.to_s
|
249
|
+
image_path[$2.to_i] = file
|
250
|
+
end
|
251
|
+
end
|
252
|
+
}
|
253
|
+
return image_path
|
254
|
+
end
|
255
|
+
|
256
|
+
if @cgi.params['plugin_image_add'][0] && @cgi.params['plugin_image_file'][0].original_filename != ''
|
257
|
+
image_dir = @cgi.params['plugin_image_dir'][0].read.untaint
|
258
|
+
image_filename = ''
|
259
|
+
image_extension = ''
|
260
|
+
image_date = date.strftime("%Y%m%d")
|
261
|
+
image_filename = @cgi.params['plugin_image_file'][0].original_filename
|
262
|
+
if image_filename =~ /(\.jpg|\.jpeg|\.gif|\.png)\z/i
|
263
|
+
image_extension = $1
|
264
|
+
|
265
|
+
image_name = dayimagelist(image_dir, image_date)
|
266
|
+
image_file = image_dir+image_date+"_"+image_name.length.to_s+image_extension.downcase
|
267
|
+
|
268
|
+
image_file.untaint
|
269
|
+
File::umask( 022 )
|
270
|
+
File::open( image_file, "wb" ) {|f|
|
271
|
+
f.print @cgi.params['plugin_image_file'][0].read
|
272
|
+
}
|
273
|
+
end
|
274
|
+
|
275
|
+
if imageex_useresize == 1 or imageex_useresize == 2
|
276
|
+
open(image_file,"rb") do |fh|
|
277
|
+
img = ImageSize.new(fh.read)
|
278
|
+
width = img.get_width
|
279
|
+
height = img.get_height
|
280
|
+
orig_type = img.get_type
|
281
|
+
if imageex_converttype == 0
|
282
|
+
new_type = "jpg"
|
283
|
+
elsif imageex_converttype == 1
|
284
|
+
new_type = "png"
|
285
|
+
end
|
286
|
+
|
287
|
+
if width
|
288
|
+
if width > imageex_thresholdsize or height > imageex_thresholdsize
|
289
|
+
small_image_file = %Q[#{image_dir}s#{image_date}_#{image_name.length.to_s}.#{new_type}]
|
290
|
+
resize_image(image_file, small_image_file, width, height, imageex_convertedwidth, imageex_convertedheight, orig_type, new_type)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
elsif @cgi.params['plugin_image_thumbnail'][0] && @cgi.params['plugin_image_file'][0].original_filename != ''
|
297
|
+
image_dir = @cgi.params['plugin_image_dir'][0].read.untaint
|
298
|
+
image_filename = ''
|
299
|
+
image_extension = ''
|
300
|
+
image_date = date.strftime("%Y%m%d")
|
301
|
+
image_filename = @cgi.params['plugin_image_file'][0].original_filename
|
302
|
+
if image_filename =~ /(\.jpg|\.jpeg|\.gif|\.png)\z/i
|
303
|
+
image_extension = $1
|
304
|
+
image_name = @cgi.params['plugin_image_name'][0].read.untaint
|
305
|
+
image_file=image_dir+"s"+image_name+image_extension.downcase
|
306
|
+
|
307
|
+
image_file.untaint
|
308
|
+
File::umask( 022 )
|
309
|
+
File::open( image_file, "wb" ) {|f|
|
310
|
+
f.print @cgi.params['plugin_image_file'][0].read
|
311
|
+
}
|
312
|
+
end
|
313
|
+
|
314
|
+
elsif @cgi.params['plugin_image_del'][0]
|
315
|
+
image_dir = @cgi.params['plugin_image_dir'][0]
|
316
|
+
image_date = date.strftime("%Y%m%d")
|
317
|
+
image_name = dayimagelist( image_dir, image_date)
|
318
|
+
image_name2= dayimagelist( image_dir, image_date, "s")
|
319
|
+
|
320
|
+
@cgi.params['plugin_image_id'].untaint.each do |id|
|
321
|
+
if image_name[id.to_i]
|
322
|
+
image_file=image_dir+image_name[id.to_i]
|
323
|
+
image_file.untaint
|
324
|
+
if File::exist?(image_file)
|
325
|
+
File::delete(image_file)
|
326
|
+
end
|
327
|
+
end
|
328
|
+
if image_name2[id.to_i]
|
329
|
+
image_file2=image_dir+image_name2[id.to_i]
|
330
|
+
image_file2.untaint
|
331
|
+
if File::exist?(image_file2)
|
332
|
+
File::delete(image_file2)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
337
|
+
rescue Exception
|
338
|
+
puts "Content-Type: text/plain\n\n"
|
339
|
+
puts "#$! (#{$!.type})"
|
340
|
+
puts ""
|
341
|
+
puts $@.join( "\n" )
|
342
|
+
end
|
343
|
+
|
344
|
+
if @imageex_yearlydir == 1
|
345
|
+
image_dir = %Q[#{@image_dir}/#{@date.year}/]
|
346
|
+
else
|
347
|
+
image_dir = %Q[#{@image_dir}/]
|
348
|
+
end
|
349
|
+
|
350
|
+
if @imageex_yearlydir == 1
|
351
|
+
image_url = %Q[#{@image_url}/#{@date.year}/]
|
352
|
+
else
|
353
|
+
image_url = %Q[#{@image_url}/]
|
354
|
+
end
|
355
|
+
|
356
|
+
Dir.mkdir(image_dir) unless File.directory?(image_dir)
|
357
|
+
|
358
|
+
|
359
|
+
n_image = imageList(@date.strftime("%Y%m%d"), image_dir).length
|
360
|
+
list = imageList(@date.strftime("%Y%m%d"), image_dir)
|
361
|
+
slist = imageList(@date.strftime("%Y%m%d"), image_dir, "s")
|
362
|
+
|
363
|
+
pretable=""
|
364
|
+
posttable=""
|
365
|
+
|
366
|
+
if n_image > 0
|
367
|
+
pretable<< %Q[<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">]
|
368
|
+
posttable << %Q[</TR></TABLE>]
|
369
|
+
end
|
370
|
+
|
371
|
+
if @conf.respond_to?(:style) and @conf.style =~ /Wiki$/i
|
372
|
+
image_plugin_tag1 = "{{"
|
373
|
+
image_plugin_tag2 = "}}"
|
374
|
+
elsif @conf.respond_to?(:style) and @conf.style =~ /RD$/i
|
375
|
+
image_plugin_tag1 = "((%"
|
376
|
+
image_plugin_tag2 = "%))"
|
377
|
+
else
|
378
|
+
image_plugin_tag1 = "<%="
|
379
|
+
image_plugin_tag2 = "%>"
|
380
|
+
end
|
381
|
+
|
382
|
+
r = ''
|
383
|
+
r << %Q[
|
384
|
+
<script type="text/javascript">
|
385
|
+
<!--
|
386
|
+
var elem=null
|
387
|
+
function ins(val){
|
388
|
+
elem.value+=val
|
389
|
+
}
|
390
|
+
window.onload=function(){
|
391
|
+
for(var i=0;i<document.forms.length;i++){
|
392
|
+
for(var j=0;j<document.forms[i].elements.length;j++){
|
393
|
+
var e=document.forms[i].elements[j]
|
394
|
+
if(e.type&&e.type=="textarea"){
|
395
|
+
if(elem==null){
|
396
|
+
elem=e
|
397
|
+
}
|
398
|
+
e.onfocus=new Function("elem=this")
|
399
|
+
}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
}
|
403
|
+
//-->
|
404
|
+
</script>
|
405
|
+
]
|
406
|
+
i = ''
|
407
|
+
i << "<tr>"
|
408
|
+
nt=0
|
409
|
+
id=0
|
410
|
+
|
411
|
+
while id < n_image do
|
412
|
+
thumbnail_tag = ''
|
413
|
+
if slist[id.to_i]
|
414
|
+
src_tag = %Q[src="#{h image_url}#{h slist[id.to_i]}"]
|
415
|
+
alt_tag = %Q[alt="#{h slist[id.to_i]}"]
|
416
|
+
else
|
417
|
+
src_tag = %Q[src="#{h image_url}#{h list[id.to_i]}"]
|
418
|
+
alt_tag = %Q[alt="#{h list[id.to_i]}"]
|
419
|
+
thumbnail_tag = %Q[<form class="update" method="post" enctype="multipart/form-data" action="#{h @update}">#{csrf_protection}<input type="hidden" name="plugin_image_name" value="#{date.strftime( '%Y%m%d' )}_#{h id}"><input type="hidden" name="plugin_image_dir" value="#{h image_dir}"><input type="hidden" name="plugin_image_thumbnail" value="true"><input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}"><input type="file" name="plugin_image_file"><input type="submit" name="plugin" value="サムネイル"></form>] if imageex_useresize == 0
|
420
|
+
end
|
421
|
+
|
422
|
+
ptag = "#{image_plugin_tag1}image #{id}, '画像の説明'#{image_plugin_tag2}"
|
423
|
+
|
424
|
+
i<< %Q[<td><table border="1" cellpadding="1" cellspacing="1"><tr><td style="text-align:center"><input type="button" onclick="ins("#{ptag}")" value="本文に追加"></td></tr><tr><td style="text-align:center">#{image_plugin_tag1}image #{h id},'title#{h id}'#{image_plugin_tag2}</td></tr><tr><td width="#{@imageex_thumbnailsize * 1.5}" height="#{@imageex_thumbnailsize * 1.3}" style="text-align:center">
|
425
|
+
<img class="form" #{src_tag} #{alt_tag} height="#{@imageex_thumbnailsize}" ></tr><tr><td>#{thumbnail_tag}<form class="update" method="post" action="#{h @update}">#{csrf_protection}<input type="hidden" name="plugin_image_del" value="true"><input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}"><input type="hidden" name="plugin_image_id" value="#{h id}"><input type="submit" name="plugin" value="画像を削除"><input type="hidden" name="plugin_image_dir" value="#{h image_dir}"></form>
|
426
|
+
</tr></table></td>] if slist[id.to_i] || list[id.to_i]
|
427
|
+
nt += 1 if slist[id.to_i] || list[id.to_i]
|
428
|
+
|
429
|
+
if nt > 0 and nt%2 == 0
|
430
|
+
i<< %Q[</TR></TABLE><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD>]
|
431
|
+
end
|
432
|
+
id +=1
|
433
|
+
end
|
434
|
+
|
435
|
+
if n_image > 0
|
436
|
+
r << %Q[<div class="form">
|
437
|
+
<div class="caption">
|
438
|
+
絵日記(一覧・削除)
|
439
|
+
</div>
|
440
|
+
|
441
|
+
#{pretable}
|
442
|
+
#{i}
|
443
|
+
#{posttable}
|
444
|
+
|
445
|
+
</div>]
|
446
|
+
end
|
447
|
+
|
448
|
+
r << %Q[<div class="form">
|
449
|
+
<div class="caption">
|
450
|
+
絵日記(追加)
|
451
|
+
</div>
|
452
|
+
<form class="update" method="post" enctype="multipart/form-data" action="#{h @update}">
|
453
|
+
#{csrf_protection}
|
454
|
+
<input type="hidden" name="plugin_image_dir" value="#{h image_dir}">
|
455
|
+
<input type="hidden" name="plugin_image_add" value="true">
|
456
|
+
<input type="file" name="plugin_image_file">
|
457
|
+
<input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}">
|
458
|
+
<input type="submit" name="plugin" value="画像の追加">
|
459
|
+
</form></div>]
|
460
|
+
end
|
461
|
+
|
462
|
+
# vim: set ts=3 sw=3 noexpandtab :
|