I am trying to download image from internet using open-uri. Here is code:
require 'open-uri'
open('0RB2132__601_K3.jpg', 'wb') do |file|
file << open('http://luxonline.luxottica.com/luxpics/watermarkedextranet/med?style=0RB2132__601_K3').read
end
But it doesn’t save image correctly. When I try to open it program reports:
Error interpreting JPEG image file (Improper call to JPEG library in state 200)
I opened original image on the internet in the Firefox and after examining it, found that it is base64 encoded image.
How to download this image from this address http://luxonline.luxottica.com/luxpics/watermarkedextranet/med?style=0RB2132__601_K3?
Using your script on OS X, it works as a charm. So your mistake is probably somewhere else