Skip to content

imagekit-developer/imagekit-rails

Repository files navigation

ImageKit Rails

Rails view helpers and Active Storage integration for ImageKit.io.

Gem Version License

Overview

The ImageKit Rails gem provides seamless integration with Ruby on Rails applications, including:

  • View helpers (ik_image_tag and ik_video_tag) with transformation support
  • Active Storage service for storing files in ImageKit
  • Automatic responsive images with srcset generation
  • Image and video transformations (resize, crop, effects, overlays)
  • Signed URLs for secure delivery

Installation

Add to your Gemfile:

gem 'imagekitio-rails'

Run:

bundle install

This will automatically install the required imagekitio core SDK (version 4.x) as a dependency.

Quick Start

Create config/initializers/imagekit.rb:

Imagekit::Rails.configure do |config|
  config.url_endpoint = ENV['IMAGEKIT_URL_ENDPOINT']
  config.public_key = ENV['IMAGEKIT_PUBLIC_KEY']
  config.private_key = ENV['IMAGEKIT_PRIVATE_KEY']
end

Get your credentials from ImageKit Dashboard → API Keys.

Basic Usage

<!-- Display an image with transformations -->
<%= ik_image_tag("/photo.jpg", transformation: [{ width: 400, height: 300 }], alt: "My Photo") %>

<!-- Display a video -->
<%= ik_video_tag("/video.mp4", controls: true) %>

<!-- Active Storage attachment with transformations -->
<%= ik_image_tag(@user.avatar, transformation: [{ width: 200, height: 200 }]) %>

Documentation

Support

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/imagekit-developer/imagekit-rails.

License

Apache License 2.0. See LICENSE for details.

About

WIP - Do not use

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published