Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gif_countdown

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gif_countdown

  • 0.2.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GifCountdown

Gem Version

Create a animated gif countdown picture using RMagick.

Each frame is a second.

Useful for mailings campaign / event notifications.

Example

Usage

blob = GifCountdown.generate(distance_in_seconds: distance_in_seconds, duration: 5)

Usage in a Rails controller:

def show
  distance_in_seconds = (some_future_event - Time.zone.now).round

  blob = GifCountdown.generate(distance_in_seconds: distance_in_seconds, duration: 10)
  send_data blob, type: 'image/gif', disposition: 'inline'
end

Make sure to build a minute cache or something, as building that images might take a couple of seconds every time!

Available Keyword Arguments:

With defaults

distance_in_seconds: nil #Number of seconds to countdown
width: 535
height: 61
fontsize: 30
padding_x: 10
duration: 60 # how many seconds to generate - linearily takes longer to generator
font: 'Ubuntu' # That font must be installed on the target host that generates the image!

I18n

It uses "I18n" to build up the words "Days", "Hours", "Seconds", "Minutes" with plurarlization. The Gem ships with en/de.

Installation

Add this line to your application's Gemfile:

gem 'gif_countdown'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gif_countdown

Contributing

Contribution directions go here.

License

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

FAQs

Package last updated on 09 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc