Module: MetaData

Included in:
Plugin::Thumbnailer::InputImage, Plugin::Thumbnailer::Thumbnail
Defined in:
lib/httpthumbnailer/plugin/thumbnailer.rb

Overview

ImageMagick Image.mime_type is absolutely bunkers! It goes over file system to look for some strange files WTF?! Also it cannot be used for thumbnails since they are not yet rendered to desired format Here is stupid implementaiton

Instance Method Summary collapse

Instance Method Details

#heightObject



12
13
14
# File 'lib/httpthumbnailer/plugin/thumbnailer.rb', line 12

def height
	@image.rows
end

#mime_typeObject



16
17
18
19
20
21
22
23
24
# File 'lib/httpthumbnailer/plugin/thumbnailer.rb', line 16

def mime_type
	#TODO: how do I do it better?
	format = @format || @image.format
	mime = case format
		when 'JPG' then 'jpeg'
		else format.downcase
	end
	"image/#{mime}"
end

#widthObject



8
9
10
# File 'lib/httpthumbnailer/plugin/thumbnailer.rb', line 8

def width
	@image.columns
end