no way to read image data from database

I don’t know exactly what errors you are seeing but…

db----

def self.up

create_table :db_files,:force => true do |t|

  t.binary :data

  t.timestamps

end

end

db—

I bet one of them is due to your not having content_type and filename in your table.

hi   content_type and filename fields are in another table called project_snapshots.I do it according to the attachment_fu plugin struction.I can just not display the image in the databse.

it seems -------<%=image_tag(url_for (:controller=>:projects,:action=>:find_db_file,:id=>p.id))-%>------- does not display the image but the image's alt words.when i right- click the alt words to check the image,i get the the url for the find_db_file action.Is this problem related with the database?

daociyiyou wrote:

Attachment_fu works fine in :file_system mode, but not in :db_file mode.

[...]

Then don't use :db_file mode. :slight_smile: Images don't belong in the DB. Best,

Marnen Laibow-Koser wrote:

daociyiyou wrote:

Attachment_fu works fine in :file_system mode, but not in :db_file mode.

[...]

Then don't use :db_file mode. :slight_smile: Images don't belong in the DB. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org

I was feeling masochistic about a year and a half ago, and had it working in :db_file mode (the challenge of one of those "proof is left as an exercise for the reader"), but the performance was so abysmal it was quickly evident that it was not a viable, long-term solution. It can be done, but I'm not even sure I have that 'tester' rails app on my machine any longer.

Just store your images on the file system, and get on with the fun things...

Thanks! My server do not approve the file system store,that is why using the db_file.

daociyiyou wrote:

Thanks! My server do not approve the file system store,that is why using the db_file.

Find a different server, then, or use S3. Even if you can get this to work, you're asking for trouble.

Best,