Module: Plugin::Thumbnailer::Service::MimeType

Included in:
InputImage, Thumbnail
Defined in:
lib/httpthumbnailer/plugin/thumbnailer/service/images.rb

Instance Method Summary collapse

Instance Method Details

#mime_typeObject

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 implementation



10
11
12
13
14
15
16
17
# File 'lib/httpthumbnailer/plugin/thumbnailer/service/images.rb', line 10

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