Paperclip + ImageMagick help needed

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
alexismarie93
Posts: 1
Joined: 2016-02-10T16:28:51-07:00
Authentication code: 1151

Paperclip + ImageMagick help needed

Post by alexismarie93 »

Hey there, I want to be able to upload multiple images at once on my website. I can only upload one image at a time at the moment. Can anybody lead me in the right direction? Here's my code




/app/models/listing.rb



class Listing < ActiveRecord::Base
has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "default.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end



/app/controllers/listings_controller.rb



...
private
# Use callbacks to share common setup or constraints between actions.
def set_listing
@listing = Listing.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def listing_params
params.require(:listing).permit(:name, :description, :price, :image)
end
end



/app/views/listings/_form.html.erb



<%= form_for @listing, :html => { :multipart => true } do |f| %>
...
...
<div class="form-group">
<%= f.file_field :image, class: "form-control" %>
</div>
<div class="form-group">
<%= f.submit class: "btn btn-primary" %>
</div>
<% end %>


/app/views/listings/show.html.erb




<p id="notice"><%= notice %></p>

<%= image_tag @listing.image.url(:medium) %>
...


/app/views/listings/index.html.erb



<h1>Listing listings</h1>

<table>
<thead>
<tr>
<th>Image</th>
<th>Name</th>
...
<tbody>
<% @listings.each do |listing| %>
<tr>
<td><%= image_tag listing.image.url(:medium) %></td>
<td><%= listing.name %></td>
...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Paperclip + ImageMagick help needed

Post by fmw42 »

Hey there, I want to be able to upload multiple images at once on my website. I can only upload one image at a time at the moment. Can anybody lead me in the right direction?
I do not believe that this is an Imagemagick-relevant topic. Perhaps you need to ask on a Paperclip or PHP or other forum. Imagemagick does not do image uploads.
Post Reply