Re: Image from database

Ank Ag
Sat, 02 Feb 2008 01:13:08 -0000

Greg Donald wrote:
> On 2/1/08, Ank Ag
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>> I want to displa a thumbnail image from the database. this is like when
>> a person logs in his thumbnail will be shown. The photo will be stored
>> in the database(MSSQL 2000) as binary data.Please help me to upload a
>> thumbnail sized image and display it on the screen.
>
> Where''s the code represe





Here the piece of code:

def photo
   @person = Person.find(params[:id])
   send_data(@person.uploaded_data,
                :filename=>@person.filename,
                 :type => @person.content_type,
            :disposition => ''inline'')

end

but when i goto http://localhost:3000/person/photo/2308
I get the following error.

private method `gsub'' called for #<Array:0x47454c4>


I also after reading a forum did the following
modified the following methods in the sqlserver_adapter.rb as follows
and things seems to work fine for me.

 def self.string_to_binary(value)
   Base64.encode64(value)
 end

 def self.binary_to_string(value)
   Base64.decode64(value)
 end

undefined method `unpack'' for #<Array:0x4611800>
--
Posted via http://www.ruby-forum.com/.