I want to create a photo gallery in Rails displaying the photos from Cloudinary. How to save the urls in the database to display them, or is there any other option to do it without saving the urls?
Many Thanks,
Imre
Cloudinary has a pretty good documentation on how to integrate its service into a Rails app. Start by adding the gem to your gem file.
http://cloudinary.com/documentation/rails_integration
What you describe: "...save only url to the Database' is basically the principle of their service. You save the image itself in their cloud and the gem provides you a #model.name_url helper inside your app as well as a url for the image.
They offer different options of setting up their cloud service with Ruby and Rails, and much can be found in their docs.
Cloudinary also has a good Doc on how to integrate carrierwave and cloudinary together for image upload.
http://cloudinary.com/documentation/rails_carrierwave
Related
I'm working on a project for school. I have it set up so that users can upload images to the web app via a form, Active Record and AWS S3. What I would like is for the user to be able to add a tag to the image so it can be organised by tags later. I read about tags on the AWS docs but it seems to all be in the AWS CLI which the user won't be using. Is there anyone that can simplify how I can do this in Rails?
I would honestly appreciate feedback, or an on edit, on what I should change about this post instead of all the down votes. I'm new to web development, and I had an honest question. If this isn't the place to ask it, please point me in the right direction.
I have a Ruby on Rails application where part of the core purpose involves displaying images that I pull from the Facebook Graph API. And I want to be able to display the images in a uniform size.
What I'm hoping I can do: I'm trying to just store the id of the image from Facebook to my database and resize the image after I pull it from Facebook's servers. I was thinking that this would save on storage costs. I've been looking at the RMagick gem that binds Ruby to the ImageMagick library, specifically their resize method.
Another option I've considered: I'm thinking about adding a cropping feature. To do this though, I think I would need to set up a storage service, like Amazon's S3. Then I would pull from the image storage service where the cropped images are stored instead of pulling from Facebook and resizing client-side.
Are there any options I might not be considering? And how accurate are my examples to approaches that could be taken.
If you have a huge number of images to show, then go with "resize - store - show". If less then go with an on-the-fly process.
Here are a few well-known gems that help you process images, but choose according to your requirement:
CarrierWave
Paperclip
Dragonfly
refile (new gem)
See "Compare CarrierWave ,Paperclip and Dragonfly in rails" and "Refile: Fixing Ruby File Uploads".
I use paperclip gem to store images to s3 and it is displayed with the url of amazon. What i need is, i want to store images in s3 and i want only the users to view the images by using the url. Now if the url is known the image can be accessed anywhere. So how can this be restricted?
There is a very detailed description of how to do this on the paperclip wiki on Github:
check here. Just provide the links created in that way only to users with permission and it should work fine.
Hello there i am new to using the google drive gem and i do not know how to use it with paperclip to upload photos to the google drive. Its a simple rails application that i am developing that uploads photos to google drive, is there any rails application example that i can use to get me started with the gem or can any body present an example here to aid we beginners using the google drive gem. Paperclip should be used to upload the files. Thank You
You'd likely have to implement a storage adapter for Paperclip. Take a look at something like https://github.com/dripster82/paperclipdropbox as an example. In that case, it looks like it only supports uploading to a single pre-authorized account. If that's OK, then modifying that to talk to Google Drive instead of Dropbox should be straightforward. If you need to support multiple users, you'd have to make sure the right credentials are being used for the current user.
Anyway, the paperclip docs are likely the best place to get started :)
I currently use the Paperclip gem to attach photos onto certain models in my project. However, I have a blog model where I use multiple photos per instance of the blog.
I'm looking for a solution where I can just upload photos into a folder on Amazon S3 and refer to these photos later using the HTML anchor tags. I don't want to attach the photos to any model.
Any suggestions?
I haven't done this myself, but I would look for the solution here http://amazon.rubyforge.org/ I believe paperclip uses it behind the hood.