Uploading profile pic using photofy gem
Hi fellas,
Photofy gem is
After uploading pic and submitting the form you will see a photofy folder will be created in app directory but it will not show the images in your app because image needs to be in public folder for that you need to symlink the photofy directory in public directory.
Photofy gem is
define photofy with the config in the model for which you want the file upload
bundle install
photofy(:avatar_image, {image_processor: Proc.new {|img| img.scale(200,200)}})here after that you need to define your file upload attribute as:
<%= f.file_field :avatar_image %>in the form where you want to upload the file after that in your action please whitelist your avatar_image attribute as:
params.require(:users).permit(:name, :avatar_image)Please be assure you have rmagick gem and imagemagick installed in your system.
After uploading pic and submitting the form you will see a photofy folder will be created in app directory but it will not show the images in your app because image needs to be in public folder for that you need to symlink the photofy directory in public directory.
ln -nfs $PWD/photofy/ public/
Comments
Post a Comment