熱門文章

2016年7月12日 星期二

[Ruby]bulid a IG app

https://www.devwalks.com/lets-build-instagram-in-rails-part-1/


https://haml2erb.org   haml to html


在實作時出現錯誤

Please help with the Paperclips!

First things first, as per the docs, you’ll need imagemagick running on your development computer. Set it up as per the instructions here.

--------------------------------------------------------------------------------
Set the MAGICK_HOME environment variable to the path where you extracted the ImageMagick files. For example:
 export MAGICK_HOME="$HOME/ImageMagick-7.0.2"
If the bin subdirectory of the extracted package is not already in your executable search path, add it to your PATH environment variable. For example:
export PATH="$MAGICK_HOME/bin:$PATH"
Set the DYLD_LIBRARY_PATH environment variable:
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
Finally, to verify ImageMagick is working properly, type the following on the command line:
magick logo: logo.gifidentify logo.gifdisplay logo.gif




--------------------------------------------------------------------------------
後來忽略,回到 https://www.devwalks.com/lets-build-instagram-in-rails-part-1/


Next we’ll add the paperclip gem to our gemfile as per their docs.
gem 'paperclip', '~> 4.2' #at the writing of this post  

Read the next bit of the docs, what does it ask you to do now?

bundle install









再上傳檔案時發生

Photo Could not run the identify command. Please install ImageMagick.

解決,
You need to change the files production.rb and development.rb which are in:
config/environments:
# Paperclip config:
Paperclip.options[:image_magick_path] = "/opt/ImageMagick/bin"
Paperclip.options[:command_path] = "/opt/ImageMagick/bin"
Just add those two lines just before the last line and restart the server.
In MacOSX system, if you are using another location, just put the right PATH there.

我的路徑是 :
Paperclip.options[:command_path] = "/Users/QJpioneer/ImageMagick-7.0.1/bin/"  Paperclip.options[:image_magick_path] = "/Users/QJpioneer/ImageMagick-7.0.1/bin/"



上傳檔案後
似乎沒有吃進去圖檔.....

沒有留言:

張貼留言