0.0
No release in over a year
Simple picture_tag helper, which can show various image formats based on browser support
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 6.1
 Project Readme

rails_picture

Simple picture_tag helper, which can show various image formats based on browser support

Report Bug / Request Feature

About The Project

Provide a new helper method to Rails views - picture_tag
It generates a <picture> HTML tag and within it places HTML tag as <img> and any other available image formats as <source> tags.

Internally it uses Rails built-in method image_tag.

Installation

Add this line to your application's Gemfile:

gem 'rails_picture'

And then execute in terminal:

bundle install

Usage

  1. Put multiple same-named images with different file formats into app/assets/images/

  2. Place following code into any Rails view. It takes the same options as Rails built in image_tag :

picture_tag(filename, **options)

Note - do not input file extension in filename

Roadmap

See the TODO for status of current development.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bundle exec rake to run the tests, rubocop. You can also run bin/console for an interactive prompt that will allow you to experiment.

License

The gem is available as open source under the terms of the MIT License.

Conduct

Project Link: https://github.com/OskarsEzerins/rails_picture

Everyone interacting in the rails_picture project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.