/ Published in: Ruby
If you get "JPEG marker not found!" error when you try to open an image file you must read it in binary mode.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<% my_file = File.open("image.jpg", "rb") {|f| f.read} img = ImageSize.new( my_file ) # Testing: get img width with image_size lib. img_witdh = img.get_width %>