Ruby on Rails Friday, August 12, 2016

Hi!

I'm using Heroku and I have the Cloudinary running with my project. The upload works fine, but when I try to upload some Data Uri to Cloudnary its not work. I saw the documentation and I know I have to use the function. I'm using carrierwave-data-uri to generate images from data-uri, It works locally, but when I change the code to integra with Cloudinary I get empty images on cloud

I know I have to use the function Cloudinary::Uploader.upload(photo) but it is not clear to me how can I integrate it to my function:

  def upload_image
    photo = params[:picture][:photo]  
    @picture = Picture.new(picture_params)
    @picture.photo_data_mimetype = 'image/jpeg'
    @picture.user_id = current_user.id 
    @picture.photo_data_uri = photo
    @picture.save
  end

who receives the data to image from javascript. If I just do Cloudinary::Uploader.upload(photo), the image is not associated with the record in my database

Thanks!



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3206dcbe-1620-43df-a01f-8e9eaa8b4333%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment