Class: OpenXml::Pptx::Parts::Image

Inherits:
OpenXml::Parts::UnparsedPart
  • Object
show all
Defined in:
lib/openxml/pptx/parts/image.rb

Constant Summary collapse

IMAGE_RELATIONSHIP_TYPE =
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image".freeze
IMAGE_TYPES =
{
  ".jpeg" => "image/jpeg",
  ".jpg" => "image/jpeg",
  ".png" => "image/png",
  ".gif" => "image/gif",
  ".bmp" => "image/bmp",
  ".tiff" => "image/tiff",
  ".jxr" => "image/vnd.ms-photo"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, extension: ".png") ⇒ Image

Returns a new instance of Image.



7
8
9
10
11
12
# File 'lib/openxml/pptx/parts/image.rb', line 7

def initialize(*args, extension: ".png")
  super(*args)
  @path = Pathname.new("ppt/media/image#{extension}")
  @content_type = IMAGE_TYPES.fetch(extension)
  @relationship_type = IMAGE_RELATIONSHIP_TYPE
end

Instance Attribute Details

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/openxml/pptx/parts/image.rb', line 5

def content_type
  @content_type
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/openxml/pptx/parts/image.rb', line 5

def path
  @path
end

#relationship_typeObject (readonly)

Returns the value of attribute relationship_type.



5
6
7
# File 'lib/openxml/pptx/parts/image.rb', line 5

def relationship_type
  @relationship_type
end