jonbuda / miro

A Ruby gem to help extract the dominant colors from an image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detecting remote file as local file

RBIII opened this issue · comments

Was detecting the url http://pagead2.googlesyndication.com/simgad/9187813815045956841 as a local file and giving this error
Errno::ENOENT: No such file or directory @ rb_sysopen - /var/folders/ss/tbk3ffkj0snff_tgm5wp0wj00000gn/T/source20160428-33492-5fpoq7./simgad/9187813815045956841 from /Users/RoccoBasso/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/tempfile.rb:136:ininitialize'` so I had to wrap in a begin/rescue block

FYI - this isn't an issue in detecting whether the file is remote or not.
The problem is in trying to detect an extension to the file when the url doesn't have an extension. You can workaround it by passing in an image_type: Miro::DominantColors.new("http://pagead2.googlesyndication.com/simgad/9187813815045956841", "png").to_hex will return colors without error.

This still doesn't work after providing the type of the file.