简体   繁体   中英

Cloudinary image transformation parameters not working in Rails app

Here's the code:

= link_to (cl_image_tag(post.image_url, width:640, quality:30, class: "img-responsive")), post_path(post)

As mentioned here , this should give me an image with quality set to 30, but I'm not seeing the change in quality of the images on the site. I've tried different values for quality ranging from 10 to 100 but I'm not seeing even a slight difference. I also tried other parameters, for example, format: "jpg" , which is supposed to force convert all non-jpg files to jpg, but it isn't working either. The width param works fine, by the way.

The cl_image_tag method accepts the image's public ID and doesn't support a URL parameter. The image tag you are getting is a fallback, which ignores all Cloudinary's parameters (except width/height which are used for the html tag). Make sure you save the public IDs in your DB. I recommend using Carrierwave , which handles the DB maintenance for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM