Changeset 33862 for platform/tdiary/plugin
- Timestamp:
- 06/09/09 20:16:06 (4 years ago)
- Files:
-
- 1 copied
-
platform/tdiary/plugin/image_detail.rb (copied) (copied from platform/tdiary/plugin/image_gps2.rb) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/tdiary/plugin/image_detail.rb
r33730 r33862 2 2 # 3 3 # 概要: 4 # 画像にGPSによる位置情報が含まれている場合は、対応する地図へのリンクを生成する。4 # 5 5 # 6 6 # 使い方: … … 12 12 13 13 =begin ChangeLog 14 2009-06-0 1kp14 2009-06-03 kp 15 15 * first version 16 * fork from image_gps .rb16 * fork from image_gps2.rb 17 17 =end 18 18 … … 48 48 exif = ExifParser.new("#{@image_dir}/#{image}".untaint) rescue nil 49 49 50 datum = nil50 google = "http://maps.google.co.jp" 51 51 52 52 if exif 53 if @conf['image_gps.add_info'] 54 alt += ' '+exif['Model'].to_s if exif.tag?('Model') 55 alt += ' '+exif['FocalLength'].to_s if exif.tag?('FocalLength') 56 alt += ' '+exif['ExposureTime'].to_s if exif.tag?('ExposureTime') 57 alt += ' '+exif['FNumber'].to_s if exif.tag?('FNumber') 58 end 53 #GPS Info 59 54 begin 60 55 lat = exif['GPSLatitude'].value … … 65 60 lon = -lon if exif['GPSLongitudeRef'].value == 'W' 66 61 datum = exif['GPSMapDatum'].value if exif.tag?('GPSMapDatum') 62 lat,lon = tky2wgs(lat,lon) if datum == 'TOKYO' 67 63 rescue 68 64 lat = nil 69 65 end 70 end 71 72 unless lat.nil? 73 lat,lon = tky2wgs(lat,lon) if datum == 'TOKYO' 66 detail = "<ul>" 67 detail += "<li>#{exif['Model'].to_s}" if exif.tag?('Model') 68 detail += "<li>焦点距離:#{exif['FocalLength'].to_s}" if exif.tag?('FocalLength') 69 detail += "<li>F値:#{exif['FNumber'].to_s}" if exif.tag?('FNumber') 70 detail += "<li>露出時間:#{exif['ExposureTime'].to_s}" if exif.tag?('ExposureTime') 71 detail += "<li>露出補正:#{exif['ExposureBiasValue'].to_s}" if exif.tag?('ExposureBiasValue') 72 unless lat.nil? 73 img_map = %Q["http://maps.google.com/staticmap?format=gif&] 74 img_map += %Q[center=#{lat},#{lon}&zoom=14&size=200x200&markers=#{lat},#{lon}&] 75 img_map += %Q[key=#{@conf['image_gps.google_maps_api_key']}&sensor=false"] 76 detail += %Q[<li><a href="#{google}/maps?q=#{lat},#{lon}">] 77 detail += "#{exif['GPSLatitude'].to_s},#{exif['GPSLatitudeRef'].value}" 78 detail += " #{exif['GPSLongitude'].to_s},#{exif['GPSLongitudeRef'].value}" 79 detail += %Q[<img class="map" src=#{img_map}></a>] 80 end 81 detail += "</ul>" 74 82 end 75 83 … … 78 86 79 87 #static map 80 unless lat.nil?81 img_map = %Q["http://maps.google.com/staticmap?format=gif&]82 img_map += %Q[center=#{lat},#{lon}&zoom=14&size=200x200&markers=#{lat},#{lon}&]83 img_map += %Q[key=#{@conf['image_gps.google_maps_api_key']}&sensor=false"]84 else85 img_map = ''86 end87 88 88 url = '' 89 89 if @conf.mobile_agent? … … 92 92 url += %Q[</a>] unless lat.nil? 93 93 else 94 url += %Q[<div class="photo_detail">#{alt}] if detail 94 95 url += %Q[<a href="#{@image_url}/#{image}">] 95 96 url += thumbnail ? img_t : img 96 url += %Q[<img class="map" src=#{img_map} border="0">] unless lat.nil?97 97 url +=%Q[</a>] 98 url += %Q[#{detail}</div>] if detail 98 99 end 99 100 url 100 101 end 101 102 102 add_header_proc do 103 103 if @mode !~ /conf$/ and not bot? then 104 104 <<-HTML 105 <style type="text/css"><!-- 106 img.map{ 107 position:fixed; 108 top:30px; 109 left:30px; 110 display:none; 111 outline:5px; 112 outline-style:solid; 113 outline-color:gray; 114 } 115 a:hover{ 116 position:relative; 117 } 118 a:hover img.map{ 119 display:block; 120 } 121 --></style> 105 <style type="text/css"><!-- 106 img.map{ 107 display:none; 108 position:absolute; 109 border:none; 110 } 111 a:hover img.map{ 112 display:inline; 113 } 114 --></style> 122 115 HTML 123 116 else
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)