[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Help! JPEG marker not found!

Min jm

10/17/2008 9:33:00 AM

I've installed "image_size" gem and I get a error message with some jpg
files.

I have a code like this:

filejpg = File.read("img.jpg")
img = ImageSize.new( filejpg )

With some jpg files it works right, but with some of them I get this
message error: JPEG marker not found!

I've searched on the net and I've seen it's something like the file is
corrupted.

Has anyone the same problem? How can I fix it?

Thx a lot!
--
Posted via http://www.ruby-....

2 Answers

Lars Christensen

10/17/2008 9:59:00 AM

0

On Oct 17, 11:32 am, Min jm <mine...@elcorreodee.com> wrote:
> filejpg = File.read("img.jpg")
> img = ImageSize.new( filejpg )
>
> With some jpg files it works right, but with some of them I get this
> message error: JPEG marker not found!
>
> I've searched on the net and I've seen it's something like the file is
> corrupted.

What platform are you on? You might need to read the file in binary
mode:

filejpg = File.open("img.jpg", "rb") {|f| f.read}

Min jm

10/17/2008 11:47:00 AM

0

It works perfectly now!! Thanks so much!

--
Posted via http://www.ruby-....