Topic: Image cropping and Upload

I'm a bit new to rails -- but, a long time web developer. 

I was wondering how people implement an image cropping and uploadering imaging to the file system. 

In the past I've rolled my own (in ASP.NET) with java-script, etc. but, I was wondering if there are any recommended plugins (or 3rd party libs) that I should be considering.

I've heard about RMagick -- are there others?

Thanks,

Rich

Re: Image cropping and Upload

I have been using attachment_fu for ages ... works really well and will even store in Amazon S3.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Image cropping and Upload

i'm not using any plug ins and was able to create a photo gallery except that i cannot update my files....

an error message always comes out telling that no action responded...

here is a part of my code in index:
#---------------edit-----------------------------
  def edit
    @photo = Photo.find(params[:id])
  end

#--------------update---------------------------
  def update
    @photo = Photo.find(params[:id])

    respond_to do |format|
      if @photo.update_attributes(params[:photo])
        flash[:notice] = 'Photo was successfully updated.'
        format.html { redirect_to(@photo) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @photo.errors, :status => :unprocessable_entity }
      end
    end
  end


and my edit.html.erb:


<h1>Edit Picture</h1>

<% form_for(:photo, @photo, :url => { :action => 'show', :id =>@photo.id }, :html => { :multipart => true }) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :Picture %><br />
    <%= f.file_field :image_file %>
  </p>

  <p>
    <%= f.label :Description %><br />
    <%= f.text_field :description %>
  </p>

  <p>
    <%= f.submit "Update" %>
  </p>
<% end %>

<%= link_to 'Show', @photo %> |
<%= link_to 'Back', photos_path %>


---------------------------------


i'm using rails2.0

Re: Image cropping and Upload

can you help me with this one...i'm new with RoR

Re: Image cropping and Upload

ooppps .. its :

<% form_for(:photo, @photo, :url => { :action => 'update', :id =>@photo.id }, :html => { :multipart => true }) do |f| %>
  <%= f.error_messages %>
...

but still.... it doesn't work...help

Re: Image cropping and Upload

attachment_fu here as well, with some tweaks to the file type detection. Has worked great.

Last edited by uberllama (2008-08-01 15:49:25)

Re: Image cropping and Upload

Pretty old post now but if anybody is still reading this. I've used both attachment_fu and paperclip.

http://www.thoughtbot.com/projects/paperclip

I found paperclip slightly easier to implement and use. It also avoids using RMagick which, as I understand it, can be a little memory hungry.

Re: Image cropping and Upload

Another vote for Paperclip here. The authors managed to squeeze in some suggestions I made, such as using the -resize method for sharper thumbnail cropping, and per-environment Amazon S3 bucket credentials (which Attachment_fu already had). Although, I just realised I haven't worked out how to convert all image uploads to jpeg - so if a user gives a png, it currently stays as png (which definitely needs changing!)....