This is another plugin which i have implemented for File uploading. The main advantage of this is that we can integrate RMagick to it easily for generating thumbnails and giving other properties to the plugin.
The main thing after downloading the plugin from http://www.kanthak.net/opensource/file_column/file-column-0.3.1.tar.gz
you just need to put 2-3 lines of code and get things going
on the page from where u want to upload a file just write 1 line of code
<%= image_tag url_for_file_column("entry", "image") %>
Controller will look something like where versions part can be included only if you configure Rmagick else just remove the 2nd line and use it :-
class Entry < ActiveRecord::Base
file_column :image, :magick => {
:versions => { "thumb" => "50x50", "medium" => "640x480>" }
}
end
Lastly Model (the most imp part) :-
class Entry < ActiveRecord::Base
file_column :image, :magick => { :geometry => "640x480>" }
end
write this in the model of the page where u want to implement the plugin
Thats it.. njoi
Sunday, February 17, 2008
File Column Plugin
Labels:
File upload in RoR,
FlieColumn
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment