No commit activity in last 3 years
No release in over 3 years
Custom image placeholders for Ruby on Rails 4 views with pictures provided by http://lorempixel.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 4.0.0
 Project Readme

lorempixel_rails

Version 1.0.0

lorempixel_rails is a Ruby Gem for custom image placeholders for views in Ruby on Rails. The images are provided by lorempixel.

Requirements

Ruby on Rails ( >= Version 4.0.0 )

Installation

Usage with Gemfile:

gem "lorempixel_rails"

$ bundle

Installation by hand:

gem install lorempixel_rails

Usage

The Gem offers a simple helper method named lorempixel_img_tag which can be used, similar to the standard image_tag helper, in all Ruby on Rails views.

Following things can be configured and change the shape of the images:

  • The size (height and width)
  • Colored [default] or gray images
  • Category (abstract,animals, business, cats, city, food, nightlife, fashion, people, nature, sports, technics & transport) [default: nature] (http://lorempixel.com/images.php)
  • Text can be added

For more information about formation and options for lorempixel images check: http://lorempixel.com/

Default and maximum image sizes:

All pictures have some default and maximums. These are:

  • 1920px as maximum for heigth and width of images
  • 100px as default value for height and width

Default picture without any options:

<%= lorempixel_img_tag %>

Picture with size of 500x300 and without category:

<%= lorempixel_img_tag(:size => {:width => 500, :height => 300}) %>

Picture with size of 600x280 and with type 'technics':

<%= lorempixel_img_tag(:size => {:width => 600, :height => 280}, :type => "technics") %>

Picture with random type:

<%= lorempixel_img_tag(:size => {:width => 600, :height => 320}, :type => "random") %>

Picture with text:

  lorempixel_img_tag(
    :size => {:width => 500, :height => 200},
    :type => "people",
    :text => "Hello People"
  )
%>

Patches & Forks

Future
  • Specific category list pictures
  • Support Caching

License

See LICENSE file

Copyright © 2014 Florian Nitschmann (f.nitschmann@googlemail.com)