Avoid "JPEG marker not found!" error


/ Published in: Ruby
Save to your folder(s)

If you get "JPEG marker not found!" error when you try to open an image file you must read it in binary mode.


Copy this code and paste it in your HTML
  1. <%
  2.  
  3. my_file = File.open("image.jpg", "rb") {|f| f.read}
  4. img = ImageSize.new( my_file )
  5.  
  6.  
  7. # Testing: get img width with image_size lib.
  8.  
  9. img_witdh = img.get_width
  10.  
  11. %>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.