Changeset 4808 for platform/tdiary
- Timestamp:
- 01/17/08 22:10:18 (5 years ago)
- Location:
- platform/tdiary
- Files:
-
- 23 added
- 1 modified
-
plugin/image_gps.rb (modified) (5 diffs)
-
util/exifparser (added)
-
util/exifparser/BUGS (added)
-
util/exifparser/ChangeLog (added)
-
util/exifparser/README (added)
-
util/exifparser/install.rb (added)
-
util/exifparser/lib (added)
-
util/exifparser/lib/exifparser (added)
-
util/exifparser/lib/exifparser.rb (added)
-
util/exifparser/lib/exifparser/makernote (added)
-
util/exifparser/lib/exifparser/makernote/canon.rb (added)
-
util/exifparser/lib/exifparser/makernote/fujifilm.rb (added)
-
util/exifparser/lib/exifparser/makernote/minolta.rb (added)
-
util/exifparser/lib/exifparser/makernote/nikon.rb (added)
-
util/exifparser/lib/exifparser/makernote/nikon2.rb (added)
-
util/exifparser/lib/exifparser/makernote/olympus.rb (added)
-
util/exifparser/lib/exifparser/makernote/prove.rb (added)
-
util/exifparser/lib/exifparser/pre-setup.rb (added)
-
util/exifparser/lib/exifparser/scan.rb (added)
-
util/exifparser/lib/exifparser/tag.rb (added)
-
util/exifparser/lib/exifparser/thumbnail.rb (added)
-
util/exifparser/lib/exifparser/utils.rb (added)
-
util/exifparser/sample (added)
-
util/exifparser/sample/exifview.rb (added)
Legend:
- Unmodified
- Added
- Removed
-
platform/tdiary/plugin/image_gps.rb
r4634 r4808  1  # image_gps.rb $Revision: 1. 5$ 1 # image_gps.rb $Revision: 1.6 $ 2 2 #  3 3 # ���: … …  12 12  13 13 =begin ChangeLog  14 2008-01-17 kp  15 * ï¿½ï¿½ï¿½í¤¤ï¿½ï¿½ï¿½ï¿½Â Â 16 2006-03-28 kp  17 * cooperation with ALPSLAB clip  18 2006-03-27 kp  19 * use exifparser 14 20 2005-07-25 kp 15 21 * correct link url when access with mobile. … …  25 31  26 32 require 'wgs2tky'  33 require 'exifparser' 27 34  28 35 def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' ) … …  36 43 if size then 37 44 if size.kind_of?(Array) 38  size = %Q| width="#{size[0].to_i}" height="#{size[1].to_i}"|  45 size = " width=\"#{size[0]}\" height=\"#{size[1]}\""  46  39 47 else 40  size = %Q| width="#{size.to_i}"| 48 size = " width=\"#{size.to_i}\"" 41 49 end 42 50 else … …  47 55 mapion = 'http://www.mapion.co.jp' 48 56  49  ( datum,nl,el ) = gps_info("#{@image_dir}/#{image}") 57 exif = ExifParser.new("#{@image_dir}/#{image}".untaint) rescue nil 50 58  51  if thumbnail then 52  %Q[<a href="#{h @image_url}/#{h image}"><img class="#{h place}" src="#{h @image_url}/#{h image_t}" alt="#{h alt}" title="#{h alt}"#{size}></a>] 53  elsif el.nil? 54  %Q[<img class="#{h place}" src="#{h @image_url}/#{h image}" alt="#{h alt}" title="#{h alt}"#{size}>] 55  else 56  if @conf.mobile_agent?  59 el = nil  60 nl = nil  61 datum = nil  62   63 if exif  64 if @conf['image_gps.add_info']  65 alt += ' '+exif['Model'].to_s if exif.tag?('Model')  66 alt += ' '+exif['FocalLength'].to_s if exif.tag?('FocalLength')  67 alt += ' '+exif['ExposureTime'].to_s if exif.tag?('ExposureTime')  68 alt += ' '+exif['FNumber'].to_s if exif.tag?('FNumber')  69 end  70 begin  71 if(exif['GPSLatitudeRef'].value == 'N' && exif['GPSLongitudeRef'].value == 'E' && exif['GPSMapDatum'].value =~ /(WGS-?84|TOKYO)/)  72 nl = exif['GPSLatitude'].value if exif.tag?('GPSLatitude')  73 el = exif['GPSLongitude'].value if exif.tag?('GPSLongitude')  74 datum = exif['GPSMapDatum'].value if exif.tag?('GPSMapDatum')  75 end  76 rescue  77 end  78 end  79   80 unless el.nil?  81 if @conf.mobile_agent? 57 82 lat = "#{sprintf("%d.%d.%.2f",*nl)}" 58 83 lon = "#{sprintf("%d.%d.%.2f",*el)}" 59  href = %Q[<a href="#{eznavi}/map?datum=#{datum=='TOKYO'?'1':'0'}&unit=0&lat=+#{lat}&lon=+#{lon}">]Â60 84 else 61 85 Wgs2Tky.conv!(nl,el) if datum =~ /WGS-?84/ 62 86 lat ="#{sprintf("%d/%d/%.3f",*nl)}" 63 87 lon ="#{sprintf("%d/%d/%.3f",*el)}" 64  href = %Q[<a href="#{mapion}/c/f?el=#{lon}&nl=#{lat}&scl=10000&pnf=1&uc=1&grp=all&size=500,500">]Â65 88 end 66  Â67  href + %Q[<img class="#{h place}" src="#{h @image_url}/#{h image}" alt="#{h alt}" title="#{h alt}" #{size}></a>]Â68  Â69 89 end  90   91 if thumbnail  92 url = %Q[<a href="#{@image_url}/#{image}"><img class="#{place}" src="#{@image_url}/#{image_t}" alt="#{alt}" title="#{alt}"#{size}></a>]  93 elsif el.nil?  94 url = %Q[<img class="#{place}" src="#{@image_url}/#{image}" alt="#{alt}" title="#{alt}"#{size}>]  95 else  96 if @conf.mobile_agent?  97 url = %Q[<a href="#{eznavi}/map?datum=#{datum=='TOKYO'?'1':'0'}&unit=0&lat=+#{lat}&lon=+#{lon}">]  98 else  99 url = %Q[<a href="#{mapion}/c/f?el=#{lon}&nl=#{lat}&uc=1&grp=all">]  100 end  101 url += %Q[<img class="#{place}" src="#{@image_url}/#{image}" alt="#{alt}" title="#{alt}" #{size}></a>]  102 end  103 url 70 104 end 71 105  72  require 'rexif_gps'  106 add_conf_proc ('image_gps','image_gps����'etc') do  107 if @mode == 'saveconf' then  108 @conf['image_gps.add_info'] = @cgi.params['image_gps.add_info'][0]  109 end  110   111 <<-HTML  112 <p>  113 <h3>���ƾ�����</h3>  114 <input type="checkbox" name="image_gps.add_info" value="true" #{if @conf['image_gps.add_info'] then " checked" end}>�����ȥ����ƾ��ä���p>  115 HTML 73 116  74  Jpeg.use_class_for(Jpeg::Segment::APP1,Exif)Â75  Â76  def gps_info(fname)Â77  fname.untaintÂ78  exif = Jpeg::open(fname,Jpeg::PARSE_HEADER_ONLY).app1Â79  Â80  return nil unless exif.is_exif?Â81  return nil unless exif.ifd0.gpsifdÂ82  Â83  gps = exif.ifd0.gpsifdÂ84  Â85  if( gps.latitude_ref.value=="N" && gps.longitude_ref.value=="E" && gps.map_datum.value =~ /(TOKYO|WGS-?84)/)Â86  return gps.map_datum.value,gps.latitude.value,gps.longitude.valueÂ87  endÂ88  rescueÂ89 117 endÂ
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)