Forum: Ruby on Rails Image attachment - broken read

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
79b8df6f17408a1c03fb3c10198e7bb8?d=identicon&s=25 openbsdpl (Guest)
on 2005-12-09 15:23
(Received via mailing list)
Hello,
I am working on Windwos XP and try to
send a mail with image attachement.

attachment :content_type => "image/jpeg",
     :body => File.read("an-image.jpg")
end

But it seems that the image is cat off
on read()... when I try to puts the read()
I can see only small part the actual image.

Whats wrong?

Tom.
Ee29d849250827377e503eaef25815ce?d=identicon&s=25 Jeremy (Guest)
on 2006-06-29 06:58
Hi Tom,

Most likely you are running into a File IO problem with the Windows port
of Ruby.  To check and see if you have the problem, try executing
File.read('somefile').length on a file larger than 16k.  If this is your
issue, you will get back a 16000ish length string.

The good news, there is a solution.  Switch to the cygwin port of Ruby.
:)

-jeremy

(here are some notes from the Windows port of Ruby)
1. This version was compiled using Microsoft Visual C++, not Cygwin.
As a result, some I/O functionality -- particularly those involving
the Unix fork() system call and pipes -- will not work. The benefit
of using MSVC is to have a more stable and reliable version of Ruby.

openbsdpl wrote:
> Hello,
> I am working on Windwos XP and try to
> send a mail with image attachement.
>
> attachment :content_type => "image/jpeg",
>      :body => File.read("an-image.jpg")
> end
>
> But it seems that the image is cat off
> on read()... when I try to puts the read()
> I can see only small part the actual image.
>
> Whats wrong?
>
> Tom.
This topic is locked and can not be replied to.