All Projects → hyperoslo → Lightbox

hyperoslo / Lightbox

Licence: other
🌌 A convenient and easy to use image viewer for your iOS app

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Lightbox

Glightbox
Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
Stars: ✭ 702 (-47.38%)
Mutual labels:  image, lightbox
Vue Cool Lightbox
Vue.js lightbox inspired by fancybox.
Stars: ✭ 196 (-85.31%)
Mutual labels:  image, lightbox
React Modal Image
A tiny React component providing modal image Lightbox.
Stars: ✭ 97 (-92.73%)
Mutual labels:  image, lightbox
Basiclightbox
The lightest lightbox ever made.
Stars: ✭ 299 (-77.59%)
Mutual labels:  image, lightbox
Amplify
A tiny script allowing inline image zoom
Stars: ✭ 458 (-65.67%)
Mutual labels:  image, lightbox
Ngx Gallery
Angular Gallery, Carousel and Lightbox
Stars: ✭ 417 (-68.74%)
Mutual labels:  image, lightbox
Silentbox
A lightbox inspired Vue.js component.
Stars: ✭ 196 (-85.31%)
Mutual labels:  image, lightbox
Mediumlightbox
Nice and elegant way to add zooming functionality for images, inspired by medium.com
Stars: ✭ 671 (-49.7%)
Mutual labels:  image, lightbox
React Image Lightbox
React lightbox component
Stars: ✭ 956 (-28.34%)
Mutual labels:  image, lightbox
Paintbynumbersgenerator
Paint by numbers generator
Stars: ✭ 85 (-93.63%)
Mutual labels:  image
Ffimageloading
Image loading, caching & transforming library for Xamarin and Windows
Stars: ✭ 1,288 (-3.45%)
Mutual labels:  image
Kirby Annotator
Kirby field for adding notes to images by pinning them to specific coordinates. Kirby 2 and 3.
Stars: ✭ 84 (-93.7%)
Mutual labels:  image
Rximagepicker
Android图片相册预览选择器、支持AndroidX,支持图片的单选、多选、图片预览、图片文件夹切换、在选择图片时调用相机拍照
Stars: ✭ 85 (-93.63%)
Mutual labels:  image
Carbon Api
Unofficial API for generating beautiful images of your source code using Carbon.
Stars: ✭ 89 (-93.33%)
Mutual labels:  image
Android Badgedimageview
Simple library for placing media type tags or text over an ImageView
Stars: ✭ 84 (-93.7%)
Mutual labels:  image
Imageselector
🌁 Android 图片选择器。充分自由定制,极大程度简化使用,支持图库多选/图片预览/单选/照片裁剪/拍照/自定义图片加载方式/自定义色调/沉浸式状态栏
Stars: ✭ 1,310 (-1.8%)
Mutual labels:  image
Photok
Encrypted Photo Safe for Android
Stars: ✭ 83 (-93.78%)
Mutual labels:  image
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (-6.22%)
Mutual labels:  lightbox
Img
🖼Image hosting powered by laravel
Stars: ✭ 92 (-93.1%)
Mutual labels:  image
React Responsive Picture
A future-proof responsive image component that supports latest Picture specification
Stars: ✭ 91 (-93.18%)
Mutual labels:  image

Lightbox

CI Status Carthage Compatible License Platform Swift

Lightbox Icon

Lightbox is a convenient and easy to use image viewer for your iOS app, packed with all the features you expect:

  • [x] Paginated image slideshow.
  • [x] Video support.
  • [x] Double-tap to zoom.
  • [x] Image caption.
  • [x] Dynamic background based on Hue
  • [x] Remote image loading and caching based on Imaginary
  • [x] Interactive transition animations.
  • [x] Powerful configuration.
  • [x] Live Demo

Table of Contents

Usage

Controller

To start your slideshow just instantiate LightboxController, set needed delegates and present it:

// Create an array of images.
let images = [
  LightboxImage(imageURL: URL(string: "https://cdn.arstechnica.net/2011/10/05/iphone4s_sample_apple-4e8c706-intro.jpg")!),
  LightboxImage(
    image: UIImage(named: "photo1")!,
    text: "This is an example of a remote image loaded from URL"
  ),
  LightboxImage(
    image: UIImage(named: "photo2")!,
    text: "",
    videoURL: URL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
  ),
  LightboxImage(
    image: UIImage(named: "photo3")!,
    text: "This is an example of a local image."
  )
]

// Create an instance of LightboxController.
let controller = LightboxController(images: images)

// Set delegates.
controller.pageDelegate = self
controller.dismissalDelegate = self

// Use dynamic background.
controller.dynamicBackground = true

// Present your controller.
present(controller, animated: true, completion: nil)

Delegates

Use LightboxControllerPageDelegate if you want to be notified about page navigation changes.

extension ViewController: LightboxControllerPageDelegate {

  func lightboxController(_ controller: LightboxController, didMoveToPage page: Int) {
    print(page)
  }
}

Use LightboxControllerDismissalDelegate to be notified when controller is about to be dismissed. Please note that LightboxController dismisses itself if it was presented initially.

extension ViewController: LightboxControllerDismissalDelegate: class {

  func lightboxControllerWillDismiss(_ controller: LightboxController) {
    // ...
  }
}

Image loading

By default images are loaded using Imaginary for reliable loading and caching. But it's easy to change this behavior using LightboxConfig

LightboxConfig.loadImage = {
  imageView, URL, completion in
  // Custom image loading
}

Video

Lightbox can show and plays video using default AVPlayerViewController. Showning video by using videoURL:

LightboxImage(
  image: UIImage(named: "photo2")!,
  text: "",
  videoURL: NSURL(string: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")
)

Override video handling if needed:

LightboxConfig.handleVideo = { from, videoURL in
  // Custom video handling
  let videoController = AVPlayerViewController()
  videoController.player = AVPlayer(url: videoURL)

  from.present(videoController, animated: true) {
    videoController.player?.play()
  }
}

Configuration

Configure text, colors, fonts of UI elements by overriding the static variables in the Lightbox configuration struct. As an example:

LightboxConfig.CloseButton.image = UIImage(named: ImageList.Lightbox.closeButton)
LightboxConfig.CloseButton.textAttributes = TextAttributes.Lightbox.closeButton
LightboxConfig.CloseButton.text = "Finish"

LightboxConfig.DeleteButton.image = UIImage(named: ImageList.Lightbox.deleteButton)
LightboxConfig.DeleteButton.textAttributes = TextAttributes.Lightbox.deleteButton
LightboxConfig.DeleteButton.text = "Delete"

LightboxConfig.InfoLabel.ellipsisText = "Show more"

Installation

Lightbox is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Lightbox'

In order to quickly try the demo project of a Lightbox just run pod try Lightbox in your terminal.

Lightbox is also available through Carthage. To install just write into your Cartfile:

github "hyperoslo/Lightbox"

To install Lightbox manually just download and drop Sources and Images folders in your project.

Author

Hyper Interaktiv AS, [email protected]

Contributing

We would love you to contribute to Lightbox, check the CONTRIBUTING file for more info.

License

Lightbox is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].