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

Option to designate format in the request #37

Closed
etcook opened this issue Jan 17, 2017 · 2 comments
Closed

Option to designate format in the request #37

etcook opened this issue Jan 17, 2017 · 2 comments

Comments

@etcook
Copy link

etcook commented Jan 17, 2017

According to the imgix API documentation, you can get the exif data by utilizing the fm modifier. Unfortunately, that doesn't seem to be supported within imgix-rails. Adding the fm option would be helpful.

@abrambailey
Copy link

abrambailey commented Oct 13, 2019

Here's what I've done to use fm to grab webp-format images:

ix_image_url(self.image.key, IMAGE_SIZES_IX[size.to_sym]) + '&fm=webp'

In mimi_types.rb:

IMAGE_SIZES_IX = {xl: { w: 1000, h: 1000 }, large: { w: 500, h: 500 }

In the view:

product.get_image_url(:large)

@sherwinski
Copy link
Contributor

To add to what @abrambailey said, you can also pass in fm directly as a parameter:

<%= ix_image_url('unsplash/bridge.jpg', {fm:'json'}) %>

Using the ix_image_url function will generate a URL whose response body would contain the exif data. This would be preferred over using ix_image_tag which would wrap the same URL in an <img> tag.

I'm going to close this issue as it is fairly old, but feel free to comment back if any further questions arise.

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

3 participants