Return to Snippet

Revision: 2645
at March 19, 2007 13:33 by charlesroper


Initial Code
#!/usr/bin/env ruby

if File.exists?(ENV['TM_BUNDLE_SUPPORT'] + "/bin/sips")
  SIPS = ENV['TM_BUNDLE_SUPPORT'] + "/bin/sips"
else
  SIPS = "sips"
end

imgsrc = `cygpath -m \"#{ENV['TM_DROPPED_FILEPATH']}\"`.chomp
imgdims = `\'#{SIPS}\' -g pixelWidth -g pixelHeight \'#{imgsrc}\'`
imgdims = imgdims.split("\n").collect { |dim| dim.gsub(/\D/,"") }
alt = File.basename(imgsrc, ".*").gsub("\\","")
print "<img src=\"#{ENV['TM_DROPPED_FILE']}\" width=\"#{imgdims[0]}\" height=\"#{imgdims[1]}\" alt=\"#{alt}\" title=\"#{alt}\"#{ENV['TM_XHTML']}>"

Initial URL

                                

Initial Description

                                

Initial Title
Image dragcommand with dimensions

Initial Tags

                                

Initial Language
Ruby