GithubHelp home page GithubHelp logo

sdsykes / fastimage Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 115.0 25.08 MB

FastImage finds the size or type of an image given its uri by fetching as little as needed

Home Page: http://github.com/sdsykes/fastimage/tree/master

License: MIT License

Ruby 100.00%

fastimage's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastimage's Issues

OpenSSL::SSL::SSLError for non-SSL URL

I ran into a really odd problem where I was getting the following error when trying to get the size of this image: http://thechangelog.com/wp-content/uploads/warp.gif

The error was:

~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (OpenSSL::SSL::SSLError)

I tried running the test from #23, first comment by sdsykes, and I got the same result where a.port returns 80 and b.port returns nil.

A stack trace shows that the error comes from:

~/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/fastimage-1.7.0/lib/fastimage.rb:218:in `fetch_using_http_from_parsed_uri'`

I eventually just stopped trying to retrieve the size from that image, but thought you should know.

svg image size

Not even sure if this is remotely possible. Can we (fastimage) get dimension of svg?

fastimage sometimes reports extents in reverse order

Consider the following code:

#!/usr/bin/env ruby
require 'fastimage'
require 'mini_magick'

path = '3/446/12454359163255rYXG9jrmnYqcZoKL.jpg'
full_path = File.join __dir__, 'data', path
img = MiniMagick::Image.open full_path
printf "%s: %i, %i, %i, %i\n", path, *FastImage.size(full_path), img[:width], img[:height]

path = '3/446/12454359163255rYXG9jrmnYqcZoK.jpg'
full_path = File.join __dir__, 'data', path
img = MiniMagick::Image.open full_path
printf "%s: %i, %i, %i, %i\n", path, *FastImage.size(full_path), img[:width], img[:height]

It outputs:

3/446/12454359163255rYXG9jrmnYqcZoKL.jpg: 230, 408, 230, 408
3/446/12454359163255rYXG9jrmnYqcZoK.jpg: 408, 230, 230, 408

These images look similar, and have equal extents.

Unable to handle permanent redirection

Some website use redirection (301 Moved permanently) for images.
Fastimage doesn't handle that well. It doesn't follow the redirection and returns nil.

FastImage.size('http://static.lexpress.fr/webservices/image/1421237')
nil

Can it return file size too?

I am planning to develop a PR, but want to know what you think of it.

I use Fastimage to validate remote image fetching. It is good for determining both the size and also the type of image. However I often need to validate file size as well. I am guessing this can be done during when Fastimage does the request too. So I won't need to do my own request in order to find it out. Thoughts?

Number of frames in a gif

Hi @sdsykes, have you looked into being able to query the number of frames in a .gif (and/or any other image types that support them)? Would love to be able to poll that to help prevent attacks like https://hackerone.com/reports/400
I'll take a look into writing up a PR for it when I can, but figured I'd get the issue ball rolling on it in the meantime. Thanks!

FastImage.size returns nil for valid jpg images

1.9.3-p392 :044 > FastImage.size("http://www.inc.com/uploaded_files/image/pan_UnicornClub_31990.jpg")
=> nil
1.9.3-p392 :045 > FastImage.size("http://www.inc.com/uploaded_files/image/pan_UnicornClub_31990.jpg", :raise_on_failure=>true)
FastImage::UnknownImageType: FastImage::UnknownImageType
from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/fastimage-1.6.3/lib/fastimage.rb:190:in rescue in initialize' from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/fastimage-1.6.3/lib/fastimage.rb:160:ininitialize'
from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/fastimage-1.6.3/lib/fastimage.rb:114:in new' from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/fastimage-1.6.3/lib/fastimage.rb:114:insize'
from (irb):45
from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.19/lib/rails/commands/console.rb:47:in start' from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.19/lib/rails/commands/console.rb:8:instart'
from /home/amit/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.19/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Quite a few og:image URLs from inc.com exhibit such behaviour for me:
1.9.3-p392 :046 > FastImage.size("http://www.inc.com/uploaded_files/image/inception-still_45146.jpg")
=> nil

Unable to handle URLs with underscores in the subdomain

Many Facebook picture URLs have underscores in its subdomain. For example:

https://fbcdn_sphotos_g-a.akamaihd.net/hphotos-ak-ash3/s720x720/578281_10150734796169826_2028767062_n.jpg

However, URI::parse doesn't handle underscores in the subdomain and throws the error

URI::InvalidURIError: the scheme https does not accept registry part: fbcdn_sphotos_g-a.akamaihd.net (or bad hostname?)

and since FastImage depends on URI::parse, it is unable to handle these types of URLs. Note that underscores are perfectly valid within the subdomain (see: http://stackoverflow.com/questions/2180465/can-someone-have-a-subdomain-with-an-underscore-in-it/2183140#2183140). Can I recommend instead we look to replace URI with Addressable http://addressable.rubyforge.org/ which handles these types of URLs. See https://github.com/sporkmonger/addressable/blob/master/lib/addressable/uri.rb#L83

content_length always return nil when open a local file

when I say:

FastImage.new('/Users/lithium/image.jpg').content_length

I expect it returns the content_length of the image file. But it returns nil.

Then I read the source code. I found that the method fetch_using_read doesn't set the @content_length.

Is this a feature? Can we set @content_length in fetch_using_read to make a consistent interface?

EXIF orientation flag

I've done some limited testing and it seems the size returned does not take into account the orientation flag.

FastImage.size returning nil periodically

FastImage is returning nil periodically... please see below:

FastImage.size(Poi.find('4f1f0880656ca6000100000c').primary_image.url)
[
[0] 318,
[1] 159
]
FastImage.size(Poi.find('4f1f0880656ca6000100000c').primary_image.url)
nil
FastImage.size(Poi.find('4f1f0880656ca6000100000c').primary_image.url)
nil
FastImage.size(Poi.find('4f1f0880656ca6000100000c').primary_image.url)
[
[0] 318,
[1] 159
]

Any ideas?
Thanks,
Nick

Getting SSL error when requesting URLs starting with https://

I'm not sure what changed from last week when this was working, but when I try to get the size of an image hosted at an HTTPS location using

FastImage.size([some SSL URL])

I get the following error:

SSL_connect returned=1 errno=0 state=unknown state: unknown protocol

As a workaround, I'm replacing "https" with "http" in the URLs before passing them to size() but it would be great if I could get this solved so it works with SSL URLs again.

It seems that the config in https://github.com/sdsykes/fastimage/blob/5a0399a8f5c8d8ef8d8a5b27d0ce071cfed5af9b/lib/fastimage.rb (line 259) should prevent this error, so I'm a bit confused.

Many thanks!

Addressable dependency is pretty heavy, can it be made optional?

retained memory by gem
-----------------------------------
  49751033  activesupport-4.1.8
  10572625  rubygems
   8561818  activerecord-4.1.8
   5367093  2.1.2.discourse/lib
   5178758  actionpack-4.1.8
   4456813  discourse/lib
   3661938  activemodel-4.1.8
   3142081  bundler-1.6.3
   2353753  railties-4.1.8
   1660286  2.1.0
   1564355  actionview-4.1.8
   1424547  mime-types-1.25.1
   1165100  message_bus-1.0.6
   1027115  addressable-2.3.6

retained objects by gem
-----------------------------------
     79476  activesupport-4.1.8
     57752  rubygems
     35331  actionpack-4.1.8
     25410  mime-types-1.25.1
     22530  2.1.0
     19698  activerecord-4.1.8
     12301  bundler-1.6.3
      9986  addressable-2.3.6

Its 1 mb of memory retained + 10k or so objects just to include it. can the work be done simply with the URI standard library?

unbounded loop (infinite) in parse_size_for_jpeg

On the attached image, its looks like the parse_size_for_jpeg state machine shot itselft in the foot, as when computing the number of chars to skip at beginning of a :skipframe
as line
skip_chars = read_int(get_chars(2)) - 2
return a number from a result (0xFF,0xFF) way bigger than the whole image size.

Its around
bytes_delivered 1028
bytes_read 1280

There should be a safeguard in the automata, for such outofbound condition as getting the whole readable size (for a local file at least) is way much less costly than an infinite loop ;-)

ashburn_miller

tiff support?

I would love to use this gem in my app, but I rely on TIFFs and would like to move away from using gm identify.

Thanks!

Deprecate Ruby 1.x

Maybe it's time for a fastimage v2 that can drop support for these so addressable can be kept up to date (even though I'd favor #45 to be resolved, as I don't use any of the HTTP stuff either).

What do you think?

Infinite loop when passing a Pathname

When passing a Pathname to FastImage#size (which responds to :read), if the image dimensions are not found within the first 256 bytes (LocalFileChunkSize), the library falls into an infinite loop.
e.g. width, height = FastImage.size(Rails.root.join('test.jpg'))

The offending code is in FastImage#fetch_using_read, namely:
while str = readable.read(LocalFileChunkSize)

Pathname#read will repeatedly return the first 256 bytes unless it is open first (such is the case if you typecast to a string beforehand).

I suspect this will affect other classes that respond to :read and behave in the same way as IO.read

Example image which exhibits this behaviour: https://puu.sh/9pOAv/e0b4e166bd.jpg

JPEG image is not recognized at all by FastImage

Hello,

We've been running into an issue where some images from Zara are not recognized at all by FastImage (1.7.0). Eg FastImage.type("http://static.zara.net/photos//2015/V/0/1/p/1639/075/067/2/w/1024/1639075067_2_1_1.jpg") => nil

But the image shows up correctly with ImageMagick identify: 1639075067_2_1_1.jpg JPEG 1024x1269 1024x1269+0+0 8-bit sRGB 201KB 0.000u 0:00.000

Any ideas what might be happening here? I didn't see anything strange in the returned headers (it's sent as an image/jpeg).

Thanks in advance, and thanks for your work on this gem!

Support for Data URI scheme

MetaInspector Gem uses Fastimage and we found that it would be useful to support the Data URI scheme. Looking at the code I think it would be quite easy to convert the base64 data into a StringIO so the rest of the code would work the same way as today.

If there is any chance of adding support for it then I can provide a PR, what do you think?

ImageFetchFailure for pngs with a specific CDN?

Hi, I am having issues gathering the sizes of png images from a specific cdn (other cdns work fine, so do other pngs, it's a strange combination of pngs coming from this cdn...).

Sample url from not working cdn (note that the image is viewable if you copy and past into your browser):

http://fbcdn-creative-a.akamaihd.net/hads-ak-xtf1/t45.1600-4/11410305_6023731601692_1599918971_n.png

Sample output from FastImage.size call:

FastImage.size("http://fbcdn-creative-a.akamaihd.net/hads-ak-xtf1/t45.1600-4/11410305_6023731601692_1599918971_n.png", raise_on_failure:true, timeout:50)

FastImage::ImageFetchFailure: FastImage::ImageFetchFailure

Sample url from cdn that works properly:

https://scontent.xx.fbcdn.net/hads-xfa1/t45.1600-4/10736922_6035637783473_440488633_n.png

Any ideas on where to start debugging?

Possible memory leak in jruby

When i run loop in console and watch for jruby process through jmap i see what count org.jruby.RubyThread objects and other thread related objects increased by time

Sample loop

10_000.times { fastimage = FastImage.new(src); fastimage.size; fastimage.type }
jmap output

86: 1173 93904 [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;
102: 582 65184 org.jruby.runtime.ThreadContext
104: 594 61776 java.lang.Thread
109: 1780 56960 java.lang.ThreadLocal$ThreadLocalMap$Entry
116: 583 51304 org.jruby.RubyThread
138: 582 32592 org.jruby.ext.fiber.ThreadFiber
144: 587 28176 java.util.concurrent.ThreadPoolExecutor$Worker
145: 1173 28152 java.lang.ThreadLocal$ThreadLocalMap
195: 583 13992 org.jruby.internal.runtime.NativeThread
198: 581 13944 org.jruby.ext.fiber.ThreadFiber$1
287: 2 4160 [Ljava.lang.Thread;
639: 23 368 java.lang.ThreadLocal
823: 7 224 org.jruby.ext.thread.Mutex
825: 4 224 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask
834: 3 216 java.util.concurrent.ThreadPoolExecutor
959: 2 160 org.jruby.ext.thread.SizedQueue$INVOKER$i$1$0$push
1214: 3 144 java.lang.ThreadGroup
1236: 5 120 org.jruby.ext.fiber.ThreadFiberState
Environment:
MacOs,
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode),
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_17-b02 [darwin-x86_64]

On MRI 2.0 Fiber object not accumulate (check with ObjectSpace.each_object(Fiber).count), but memory increase by time

ICO support?

Hi @sdsykes,

Would you be opposed to supporting .ico format files? Just kind of curious why they aren't, is it intentional, etc.? Can put some time into a PR if there isn't some reason against it.

Thanks!
Jon

'random' ruby segfaults with webrick

This is probably not that actionable, but noticing a segfault in ruby's core protocol.rb:135 after running FastImage.size on a collection links running webrick. It seems to be happen randomly, sometimes never at all.

I'll investigate a bit and see if I can come up with a better report.

/Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:135: [BUG] Segmentation fault
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]

-- control frame ----------
c:0091 p:---- s:0479 b:0479 l:000478 d:000478 CFUNC :read_nonblock
c:0090 p:0025 s:0475 b:0474 l:000473 d:000473 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:135
c:0089 p:0025 s:0471 b:0471 l:000470 d:000470 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:116
c:0088 p:0013 s:0465 b:0465 l:000464 d:000464 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:126
c:0087 p:0012 s:0462 b:0462 l:000461 d:000461 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2211
c:0086 p:0013 s:0456 b:0456 l:000455 d:000455 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2200
c:0085 p:0072 s:0448 b:0448 l:000447 d:000447 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1183
c:0084 p:0097 s:0442 b:0442 l:000441 d:000441 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1169
c:0083 p:0046 s:0435 b:0435 l:000429 d:000434 BLOCK /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1162
c:0082 p:0057 s:0433 b:0433 l:000432 d:000432 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:627
c:0081 p:0025 s:0430 b:0430 l:000429 d:000429 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1160
c:0080 p:0033 s:0423 b:0423 l:000422 d:000422 METHOD /Users/rromanchuk/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1073
c:0079 p:0032 s:0417 b:0417 l:0012e8 d:0012e8 METHOD /Users/rromanchuk/.rvm/gems/ruby-1.9.2-p136@304/gems/fastimage-1.2.9/lib/fastimage.rb:176
c:0078 p:0147 s:0414 b:0414 l:000413 d:000413 METHOD /Users/rromanchuk/.rvm/gems/ruby-1.9.2-p136@304/gems/fastimage-1.2.9/lib/fastimage.rb:156
c:0077 p:---- s:0409 b:0409 l:000408 d:000408 FINISH
c:0076 p:---- s:0407 b:0407 l:000406 d:000406 CFUNC :new
c:0075 p:0019 s:0402 b:0402 l:000401 d:000401 METHOD /Users/rromanchuk/.rvm/gems/ruby-1.9.2-p136@304/gems/fastimage-1.2.9/lib/fastimage.rb:101

What is the benefit of using fastimage?

Hi sdsykes,

With my curiosity. I can write a simple code as below that produce width, and height of online image without using fastimage:

str = identify -format "%f,%w,%h" "http://stephensykes.com/images/ss.com_x.gif"
arr=str.split(',')
puts "w=#{arr[1]} h=#{arr[2]}"

Could you please show me the benefit of using your library instead of using codes above?

Best regards,
Dat Ngo

Large, local files are taking a long time to process size

I'm seeing an issue where larger image files, even if locally available, are taking a long time to find their size. Specifically, this is the output of a tiff only ~9 MB in size. example.tif.zip

irb(main):003:0> f = File.open('./example.tif')
=> #<File:./example.tif>
irb(main):004:0> Benchmark.realtime do
irb(main):005:1* FastImage.size(f)
irb(main):006:1> end
=> 99.168221

I would expect files that are already available to process much faster. Thoughts?

FastImage does not respect EXIF orientation

I would love to use FastImage, because it's so much faster on one core than ImageMagick's identify is on eight! However, it gives incorrect results for some images. For example:

http://pine-fm.s3.amazonaws.com/gen_thumbnail/2008.06.17.15.46.54.jpg

$ ruby -e "require 'fastimage'; p FastImage.size('gen_thumbnail/2008.06.17.15.46.54.jpg')"
[445, 334]

$ ruby -e "p `identify -format \"%w %h\" gen_thumbnail/2008.06.17.15.46.54.jpg`"
"334 445"

exiftool also agrees with identify.

Note that different programs handle this image differently: Windows preview shows it correctly, OS X preview shows it wrong; Chrome shows it correctly in an img tag, but wrong if open directly as a file; IE shows it correctly when opened as a file and in an img tag, etc.

Still, I believe the right thing to do is to report the same value that identify and exiftool do, by respecting the Orientation value.

Strange bug

I have a strange problem with the FastImage gem. When I try to access the variable directly or call methods on it, I get a nil error. Rails says that the variable doesn't exist, so something like FastImage.size(url)[0] won't work. However, if I use 'puts', i.e puts FastImage.size(url) the variable can be accessed.

In the console, everything is working fine (I can do things like size = FastImage.size(url), size[0], etc.) Any ideas as to what is going on?

FastImage.size(url) Always Returns nil When the Server Requires a Proxy for Outbound Internet Connection

In the following function

  def setup_http
    @http = Net::HTTP.new(@parsed_uri.host, @parsed_uri.port)
    @http.use_ssl = (@parsed_uri.scheme == "https")
    @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    @http.open_timeout = @timeout
    @http.read_timeout = @timeout
  end

Net::HTTP should be replaced with something like following:

  def self.get_http_class proxy_string
    if proxy_string
      proxy_uri = URI.parse proxy_string
      return Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port)
    else
      return Net::HTTP
    end
  end

Usually proxy_string is something like ENV['http_proxy'] or ENV['https_proxy'] depending on the request schema http or https.

Would you mind fixing this? We are basically blocked by this proxy issue.

Size of SVG returning nil

When try to size a SVG that is returned from a form as a Ruby File, I receive nil. If local sizing of svg's are not supported, documentation needs to be updated.

Example image below:

Logo-Bw.svg.zip

Failing spec test.jpg test_should_report_size_correctly

The mentioned spec fails on both ruby 1.9.3 and 2.0.0 with fakeweb 1.3.0. It seems to get into an semi-endless loop while trying to find the size for test.jpg.

[11/24] FastImageTest#test_should_report_size_correctly

Added for debugging:

def parse_size_for_jpeg
    loop do
      puts @state.inspect
      # ...
    end
end

Output:

nil
:started
:sof
:skipframe
:do_skip
:started
:sof
:skipframe
:do_skip
:started
:started
:started
...

It also troubles me to see an endless loop here. Shouldn't it try max n bytes until it gives up?

Btw. FastImage.size("test/fixtures/test.jpg") from IRB works fine.

Problem using fastimage in heroku using ssl

I found a crash when running FastImage.size(src) with this particular url "https://pixel.quantserve.com/pixel/p-9tnwrxnK1azF1.gif" in production.

In my localhost the execution returns [1, 1] array ok. But I noticed that in the heroku production environment it throws an ssl exception:

irb(main):002:0> FastImage.size("https://pixel.quantserve.com/pixel/p-9tnwrxnK1azF1.gif")
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: sslv3 alert handshake failure
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:918:in `connect'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:918:in `connect'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:851:in `start'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:1367:in `request'
    from /app/vendor/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
    from /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/net/http.rb:1278:in `request_get'
    from /app/vendor/bundle/ruby/2.0.0/gems/fastimage-1.6.3/lib/fastimage.rb:212:in `fetch_using_http_from_parsed_uri'
    from /app/vendor/bundle/ruby/2.0.0/gems/fastimage-1.6.3/lib/fastimage.rb:207:in `fetch_using_http'
    from /app/vendor/bundle/ruby/2.0.0/gems/fastimage-1.6.3/lib/fastimage.rb:173:in `initialize'
    from /app/vendor/bundle/ruby/2.0.0/gems/fastimage-1.6.3/lib/fastimage.rb:114:in `new'
    from /app/vendor/bundle/ruby/2.0.0/gems/fastimage-1.6.3/lib/fastimage.rb:114:in `size'

What should I do? It's something that can be changed in the fastimage code or some configuration on the server side?

Thanks

license

hello,

there is no license specified. Should we assume this a standard BSD style license?

Exceptions not caught

Some days you wonder "damn, I wish it was easy to do foo".

Although you tell yourself "bah, never gonna find that". You still head over to github. You search and bam! it's right there :-)

Thanks for FastImage. Exactly what I was looking for.

I found some cases when an exception is raised and not caught though. At minimum, you probably want to rescue these. For the first one there's something fishy going on, coz I get an image in my browser, so there probably a way to get the info.

FastImage.size("http://banners.wunderground.com/banner/krd_condV2/language/www/US/FL/Miami.gif")
Net::HTTPBadResponse: wrong chunk size line:

  1. FastImage.size("http://cma.timesonline.co.uk/multimedia/archive/00703/Exclusive_Preview_S_703431a.gif")
    EOFError: end of file reached

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.