i was trying for multiple image upload with dragonfly in rails3. i searched for some tutorials, but couldn't find any. i found a tutorial for multiple image upload with Carrierwave, but couldnt find luck with dragonfly .. any help please :)
multiple image upload with dragonfly
4.1k Views Asked by anand At
1
There are 1 best solutions below
Related Questions in RUBY-ON-RAILS-3
- is there a way to write this clean?
- HTML to pdf conversion using wickedpdf with page count
- Rails rspec feature itegration testing for basic auhentication
- ImageKit works fine on local but doesn't work on heroku why?
- SSL Configuration Issue: Website Redirects Too Many Times and CSRF Token Mismatch
- How to fix permission error while install bundle for rails project on ubuntu?
- Active Admin filters not displaying on screen but present in the html DOM
- Why is the page title not not changing in a turbo-ios app
- Resolving 'net::ERR_BLOCKED_BY_CLIENT' Error After Upgrading Ruby to 3.2.2 and Rails to 7 with jsbundling Gem
- Cant install Mysql2 Gem::Ext::BuildError: ERROR: Failed to build gem native extension
- Filtering Users with Associated Records by Specific Date in Rails
- How to handle the params for accepts_nested_attributes_for for has_many association containing a lot of fields on both associated table
- Issue when Rounding Decimal values
- Map an activerecord array to avoid that two item with the same attribute are in a sequential position
- Devise Registration Ruby on Rails - Migration Error: Duplicate column name
Related Questions in IMAGE-UPLOADING
- PHP: empty folders when uploading an image to multiple folders
- Profile Image Uploading For Django Not Working
- Asp.net MVC Image Upload and Preview
- How to "reupload" image to server with input type="file" and axios?
- AWS S3 - Image cannot be displayed because it contains errors
- php image upload with watermark and resize
- ASP.NET: Image URL is correct, but image does not display
- How to Upload Multiple Images from Multiple Browsing in Laravel?
- React native post image to server Required request part 'file' is not present
- auto detect new files in DIR and send them to google drive
- Image Uploader in React by merging an object and DataForm file
- How to transfer photos to x-www-form-urlencoded immediately after taking a picture EXPO
- Cannot crop image using react-image-crop
- Vuetify + Spring: How do I upload and display images correctly?
- How can I add required validation on filepond vue?
Related Questions in DRAGONFLY-GEM
- Rails - Dragonfly image upload to OCI using angular frontend
- Not able to change S3 path of images in refinerycms (using dragonfly) in rails
- DragonFly Image Not Displaying
- Can I customize the Dragonfly image_uid?
- Leave attachment on storage (S3) when destroying a Dragonfly object
- Dragonfly convert not working with ImageMagick's profile option
- What is the correct way of using a custom Dragonfly storage backend in Refinery?
- Multi file upload with polymorphic association [Rails, Dragonfly]
- Rails: Dragonfly UID not found although it displays the path correctly
- param is missing or the value is empty: gallery
- Dragonfly on the fly thumbs, server side cache?
- "rails generate dragonfly" returns "Could not find generator dragonfly."
- rails generate dragonfly returns undefined method `public_key=' for #<Recaptcha after migrating from Heroku to dedicated server
- Duplicate images uploaded with Dragonfly
- Render Dragonfly images in PDF using wicked-pdf
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Preface
Dragonfly itself can be used to manage media for your project in general, similar to paperclip. The question itself boils down to the multiple file upload within a rails application. The some tutorials on this topic available, which can easily be adapted to models using Dragonfly for storing specific files on them. I would suggest you look into those and try to adapt them for your project.
However, I can present a minimum example which i built for a rails 3.2 app currently in development, which isn't perfect (validation handling for example), but can give you some starting points.
Example
Just for reference, the essential idea is taken from here. This example is done with Rails 3.2.x.
Let's say you have a vacation database, where users may create trip reports on vacations they took. They may leave a small description, as well as some pictures.
Start out by building a simple ActiveRecord based model for the trips, lets just call it
Tripfor now:As you can see, the model has trip images attached to it via a
has_manyassociation. Lets have a quick look at theTripImagemodel, which uses dragonfly for having the file stored in the content field:The trip image it self stores the file attachment. You may place any restrains within this model, e.g. file size or mime type.
Let's create a
TripControllerwhich has anewandcreateaction (you can generate this via scaffolding if you like, it is by far nothing fancy):Nothing special here, with the exception of creating the images from another entry than the
paramshash. this makes sense when looking at the the file upload field within thenew.html.erbtemplate file (or in the partial you use for the fields on theTripmodel):This should work for the moment, however, there are no limitations for the images on this right now. You can restrict the number of images on the server side via a custom validator on the
Tripmodel:I leave this up to you, but you could also use client side validations on the file field, the general idea would be to check the files upon changing the file field (in CoffeeScript):
Summary
You can build a lot out of existing tutorials, as dragonfly does not behave that differently to other solutions when it comes to just to uploading files. However, if you'd like something fancier, I'd suggest jQuery Fileupload, as many others have before me.
Anyways, I hope I could provide some insight.