diff --git a/lib/thumbnail/formats.rb b/lib/thumbnail/formats.rb index c7ac2c2aa9ed9c413070c934f4432d802d428fc6..fcbe160674a86a676dcef60d9894ecb7804de9c8 100644 --- a/lib/thumbnail/formats.rb +++ b/lib/thumbnail/formats.rb @@ -1,7 +1,7 @@ module Thumbnail module Formats - def file_format file + def get_file_format file unless file.nil? file_format = File.extname(file) else @@ -10,21 +10,35 @@ module Thumbnail file_format end + def array_to_upcase array + upcase_array = [] + array.each do |a| + upcase_array << a.upcase + end + upcase_array + end + + def archive_formats + lower = [".rar", ".zip"] + upper = array_to_upcase lower + return lower + upper + end + def accepted_video_formats lower = [".mp4", ".wmv", ".3gp", ".asf", ".avi", ".flv", ".swf", ".mov", ".mpg", ".mpeg", ".rmvb", ".rm", ".vob", ".webm"] - upper = [".MP4", ".WMV", ".3GP", ".ASF", ".AVI", ".FLV", ".SWF", ".MOV", ".MPG", ".MPEG", ".RMVB", ".RM", ".VOB", ".WEBM"] + upper = array_to_upcase lower return lower + upper end def accepted_image_formats lower = [".jpg", ".jpeg", ".gif", ".png", ".bmp", ".tif", ".wmf"] - upper = [".JPG", ".JPEG", ".GIF", ".PNG", ".BMP", ".TIF", ".WMF"] + upper = array_to_upcase lower return lower + upper end def accepted_other_formats lower = [".pdf", ".pps"] - upper = [".PDF", ".PPS"] + upper = array_to_upcase lower return lower + upper end