lib/carrierwave-picture/picture_converter.rb in carrierwave-picture-0.2.2 vs lib/carrierwave-picture/picture_converter.rb in carrierwave-picture-0.3.3
- old
+ new
@@ -1,6 +1,12 @@
module PictureConverter
def self.convert(current_path)
- system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.webp" unless File.extname(current_path) == "webp"
- system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.jp2" unless File.extname(current_path) == "jp2"
+
+ unless File.exist?("#{current_path}.webp")
+ system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.webp"
+ end
+ unless File.exist?("#{current_path}.jp2")
+ system "convert -interlace Plane -quality 80 #{current_path} #{current_path}.jp2"
+ end
+
end
end