Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Invalid value ... for parameter image_file_type #17

Closed
vlado opened this issue May 11, 2012 · 5 comments
Closed

RuntimeError: Invalid value ... for parameter image_file_type #17

vlado opened this issue May 11, 2012 · 5 comments

Comments

@vlado
Copy link

vlado commented May 11, 2012

I'm using latest version of your gem (1.0.22), and when I try to upload image without extension

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA")

i get RuntimeError

RuntimeError: Invalid value com/images for parameter image_file_type

I tried with adding format option and it worked

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA", format: "jpg")

But then I can't add named transformation as an option (it is ignored).

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA", format: "jpg", transformation: "avatar")

Transformation option when uploading image with extension works fine

Cloudinary::Uploader.upload("http://hirenj.files.wordpress.com/2012/02/nate.jpg", transformation: "avatar")

This one also ignores transformation option

Cloudinary::Uploader.upload("http://hirenj.files.wordpress.com/2012/02/nate.jpg", transformation: "avatar", format: "jpg")
@nadavs
Copy link
Contributor

nadavs commented May 14, 2012

Thank you for reporting this issue.
It is now fixed (on the server-side).

You can now upload images from remote URLs without file extensions. Cloudinary automatically detects the format of the image and returns in the upload's result a Cloudinary URL with the correct extension.
You can also specify incoming named transformation and format conversions as in the examples you sent.

Note that specifying 'transformation' on the upload API call, means that the original image is not stored in the cloud. Only the transformed version is stored ('avatar' in your example). Therefore, it is usually recommended to keep the original image and create transformed versions (e.g., avatar) either dynamically (using cl_image_tag) or eagerly (using the 'eager' parameter of the upload API).

Please check if it works fine for you now.

@nadavs nadavs closed this as completed May 14, 2012
@vlado
Copy link
Author

vlado commented May 15, 2012

Everything works fine for me now.

I don't need original image. On upload I'm transforming images to max width/height I need for my app and then create thumbs later using cl_image_tag.

Thanks for the fix and note

@farukca
Copy link

farukca commented May 1, 2013

I am trying to upload txt files but it is givinig an error "Invalid value txt for parameter image_file_type".

I am using cloudinary_gem with carrierwave. in my gemfile;

gem 'carrierwave'
gem 'mini_magick'
gem 'cloudinary'

and my uploader class;

  class DocumentUploader < CarrierWave::Uploader::Base
      include Cloudinary::CarrierWave
      def extension_white_list
          %w(jpg jpeg gif png tiff pdf doc docx xls xlsx txt)
      end
  end

I think, we must provide resource_type=raw option in class, but I could not find how to put this code in class,
can you help me,

best regards from istanbul.

@TalLevAmi
Copy link
Contributor

Are you using the latest GEM? The current version of the gem uses resource_type=auto by default.

@farukca
Copy link

farukca commented May 1, 2013

Thanks for fast reply, as you say, I updated to last version and the problem solved. thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants