I have successfully used carrier wave to upload image files. I want the form to be able to accept image files and pdf's. When I try to upload a pdf, it does not upload the file. It has to do with the line:
process :resize_to_fill => [166,166]
If I take that out, pdf's work. The problem is I need that line because I need all pictures uploaded need to be resized. Here is the uploader:
class PortfoliofileUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :picture do
process :resize_to_fill => [166,166]
end
def extension_white_list
%w(jpg jpeg gif png pdf doc docx)
end
end
Does anyone know how I can fix it so images and pdf's will work? Thanks.
UPDATE:
Portfolio show page (2 versions):
version 1:
<% @portfolio.portfolio_pics.collect{|picture| picture.port_pic.picture}.each do |pic| %>
<li><a href="#"><%= image_tag pic %></a></li>
<% end %>
version 2:
<% @portfolio.portfolio_pics.each do |pic| %>
<li><a href="#"><%= image_tag pic.port_pic.picture %></a></li>
<% end %>