Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def batch
- if request.post?
- images = params[:images]
- session[:images_to_tag] = []
- images.each do |id, img|
- unless img['uploaded_data'].blank?
- uploaded_data = params[:images][id].delete(:uploaded_data) # pop off uploaded data
- image_attributes = params[:images][id].merge(params[:image])
- @image = Image.new(image_attributes)
- @image_picture = ImagePicture.new(:image_obj => @image)
- @image_picture.uploaded_data = uploaded_data
- @image.picture = @image_picture
- @image.user = @current_user
- @image.save!
- session[:images_to_tag] << @image.id
- end
- end
- flash[:notice] = 'Your image was successfully uploaded.'
- session[:image_tagging_job_key] = Image.start_tagging(session[:images_to_tag])
- redirect_to :action => 'auto_tagging_progress'
- end
- rescue ActiveRecord::RecordInvalid
- render :action=>'batch'
- end
Add Comment
Please, Sign In to add comment