Module: Sass::Images::Functions

Defined in:
lib/sass/images/functions.rb

Instance Method Summary collapse

Instance Method Details

#image_height(path) ⇒ Object



12
13
14
15
# File 'lib/sass/images/functions.rb', line 12

def image_height(path)
  image = Image.new(resolve_path path)
  Sass::Script::Number.new image.height, ['px']
end

#image_width(path) ⇒ Object



7
8
9
10
# File 'lib/sass/images/functions.rb', line 7

def image_width(path)
  image = Image.new(resolve_path path)
  Sass::Script::Number.new image.width, ['px']
end

#inline_image(path) ⇒ Object



17
18
19
20
21
# File 'lib/sass/images/functions.rb', line 17

def inline_image(path)
  image = Image.new(resolve_path path)
  data_uri = "data:#{image.content_type};base64,#{image.base64}"
  Sass::Script::String.new "url(#{data_uri})"
end