Hi There! I just got it working, but now I have another strange problem. I rewrote the photos controller and did some hacks in attachment_fu_hacks, e.g. I added the method public_filename. My next problem is saving the data. I can upload images and the entries were all made to the database, but in db_files there a only a few parts of the whole image. In photos are the correct sizes of the data, but in db_files are just a few bytes in every record. Any idea why this happens and where the problem is?
Regards, Martin On 31 Mrz., 12:51, mhaeusler <[email protected]> wrote: > Hi Simon! > > Thanks for the link. But I just don't get it work. I still get the > error > > "undefined method `public_filename' for <#Photo...>" > > I figured out that the method 'public_filename' only works for > file_system and s3_storage but not for db_files > (seehttp://svn.techno-weenie.net/projects/plugins/attachment_fu/README). I > can upload and edit photos, the entries were all made. The tables > photos and db_files were filled and in photos were set the correct ID > in column 'db_files_id'. But I can't display my uploaded photos. I > guess I have to rewrite the photos controller and all the views > displaying photos, right? > > Regards, > Martin > > On 12 Mrz., 02:49, LostyJai <[email protected]> wrote: > > > Hi Martin, > > > Have a ready of this:http://jeremyweiland.com/archives/49 > > > Regards, > > Simon > > > On Mar 12, 3:20 am, mhaeusler <[email protected]> > > wrote: > > > > Hi there! > > > > First I'm new to Ruby, RoR and the powerful and great community > > > engine. I want to store all my photos in the database and not on file > > > system, therefore I changed storage: 'file_system' to storage: > > > 'db_files' in application.yml I also created a table db_files with the > > > fields id and data as blob (mysql). At last I added the field > > > "db_file_id" to the table "photos". > > > > I restarted my application and everything just worked fine as long as > > > I did not add a photo! Everytime I try to add a new photo (e.g. user > > > avatar) I get the following error: > > > > NoMethodError in Base#site_index > > > > Showing vendor/plugins/community_engine/app/views/posts/ > > > _post.html.haml where line #8 raised: > > > NoMethodError > > > > Extracted source (around line #8): > > > .vcard.author > > > %h5 > > > %a{:href=>"#{user_post_path(post.user, > > > post)}", :class=>"photo", :rel=>"bookmark"} > > > =image_tag((post.first_image_in_body || > > > post.user.avatar_photo_url > > > (:thumb)), :alt=>"", :width=>"50", :height=>"50") > > > > %ul > > > %li.fn=link_to post.user.login, user_path(post.user) > > > > I think the problem is, that CE still tries to read the file from the > > > filesystem and not from the database. When I look at the database all > > > the entries where correct done. There is a new entry in db_files and > > > the related photo has the correct ID of the entry in db_files. > > > > Is there any guide how to use db_files instead of file_system? I think > > > the solution of my problem is to write a controller which outputs the > > > image from the database, but currently I don't know how to start and > > > what's the best solution for this. Hope, anybody can help me! > > > > Thanks a lot > > > Martin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CommunityEngine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/communityengine?hl=en -~----------~----~----~----~------~----~------~--~---
