All Projects → suzuki-0000 → Skphotobrowser

suzuki-0000 / Skphotobrowser

Licence: mit
Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Skphotobrowser

PhotoMiner
Photo finder application for macOS
Stars: ✭ 102 (-95.54%)
Mutual labels:  photos, photo-browser
Photostructure For Servers
PhotoStructure for Servers
Stars: ✭ 98 (-95.71%)
Mutual labels:  photos, photo-browser
Photato
Photato - The personal Pictures gallery
Stars: ✭ 130 (-94.31%)
Mutual labels:  photos, photo-browser
Hephotopicker
自由定制支持视频,图片的相册选择器
Stars: ✭ 146 (-93.61%)
Mutual labels:  photos
Images
Public domain photos of Members of the United States Congress
Stars: ✭ 154 (-93.26%)
Mutual labels:  photos
Aphotomanager
Manage local photos on Android: gallery, geotag with photomap, privacy, tags, find, sort, view, copy, send, ... .
Stars: ✭ 164 (-92.82%)
Mutual labels:  photos
Unsplashkit
Swift client for Unsplash
Stars: ✭ 183 (-91.99%)
Mutual labels:  photos
Instagramphotopicker
Photo-picker like Instagram
Stars: ✭ 144 (-93.7%)
Mutual labels:  photos
Ownphotos Frontend
Stars: ✭ 171 (-92.52%)
Mutual labels:  photos
Metax
An iOS app that helps you check, edit and delete metadata of photos, including but not limited to EXIF, TIFF...
Stars: ✭ 165 (-92.78%)
Mutual labels:  photos
Bonsai
Self-hosted family wiki engine / photoalbum
Stars: ✭ 162 (-92.91%)
Mutual labels:  photos
Friendlypix Ios
Friendly Pix iOS is a sample app demonstrating how to build an iOS app with the Firebase Platform.
Stars: ✭ 157 (-93.13%)
Mutual labels:  photos
Pynet Pytorch
Generating RGB photos from RAW image files with PyNET (PyTorch)
Stars: ✭ 169 (-92.6%)
Mutual labels:  photos
Swiftycam
A Snapchat Inspired iOS Camera Framework written in Swift
Stars: ✭ 1,879 (-17.77%)
Mutual labels:  photos
Horizonsdk Ios
Horizon SDK for iOS
Stars: ✭ 171 (-92.52%)
Mutual labels:  photos
Pictureselectorlight
Picture Selector Library for Android or 图片选择器
Stars: ✭ 145 (-93.65%)
Mutual labels:  photos
Alcameraviewcontroller
A camera view controller with custom image picker and image cropping.
Stars: ✭ 2,023 (-11.47%)
Mutual labels:  photos
Chevereto Free
Self-hosted Image Hosting solution. Start your own Flickr/imgur alternative with your own rules.
Stars: ✭ 2,275 (-0.44%)
Mutual labels:  photos
Photos
📸 Your memories under your control
Stars: ✭ 157 (-93.13%)
Mutual labels:  photos
Lovedoudou
爱逗逗——集新闻资讯,影视评论,漂亮妹子,视频播放于一身的app,用于练习MVP+Retrofit+RxJava+Glide框架,如今将其开源,仅供学习探讨,禁止商用。
Stars: ✭ 165 (-92.78%)
Mutual labels:  photo-browser

SKPhotoBrowser

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

Simple PhotoBrowser/Viewer inspired by facebook, twitter photo browsers written by swift

Swift5 Build Status Platform Contributors

features

  • Display one or more images by providing either UIImage objects, or string of URL array.
  • Photos can be zoomed and panned, and optional captions can be displayed
  • Minimalistic Facebook-like interface, swipe up/down to dismiss
  • Ability to custom control. (hide/ show toolbar for controls, / swipe control)
  • Handling and caching photos from web
  • Landscape handling
  • Delete photo support(by offbye). By set displayDelete=true show a delete icon in statusbar, deleted indexes can be obtain from delegate func didDeleted
Table/CollectionView sample Button tap sample gif sample
sample sample sample

Requirements

    - iOS 9.0+
    - Swift 2.0+
    - ARC

Version vs Swift version.

    Below is a table that shows which version of SKPhotoBrowser you should use for your Swift version.
Swift version SKPhotoBrowser version
5.0 >= 6.1.0
4.2 >= 6.0.0
4.1 >= 5.0.0
3.2 >= 4.0.0
2.3 2.0.4 - 3.1.4
2.2 <= 2.0.3

Installation

CocoaPods

available on CocoaPods. Just add the following to your project Podfile:

pod 'SKPhotoBrowser'
use_frameworks!

Carthage

To integrate into your Xcode project using Carthage, specify it in your Cartfile:

github "suzuki-0000/SKPhotoBrowser"

Info.plist

If you want to use share image feature, it includes save image into galery, so you should specify a permission into your Info.plist (if you haven't done it yet).

<key>NSPhotoLibraryAddUsageDescription</key>
<string>Used to save images into your galery</string>

Swift Package Manager

Available in Swift Package Manager. Use the repository URL in Xcode

Usage

See the code snippet below for an example of how to implement, or see the example project.

from UIImages:

// 1. create SKPhoto Array from UIImage
var images = [SKPhoto]()
let photo = SKPhoto.photoWithImage(UIImage())// add some UIImage
images.append(photo)

// 2. create PhotoBrowser Instance, and present from your viewController.
let browser = SKPhotoBrowser(photos: images)
browser.initializePageIndex(0)
present(browser, animated: true, completion: {})

from URLs:

// 1. create URL Array
var images = [SKPhoto]()
let photo = SKPhoto.photoWithImageURL("https://placehold.jp/150x150.png")
photo.shouldCachePhotoURLImage = false // you can use image cache by true(NSCache)
images.append(photo)

// 2. create PhotoBrowser Instance, and present.
let browser = SKPhotoBrowser(photos: images)
browser.initializePageIndex(0)
present(browser, animated: true, completion: {})

from local files:

// 1. create images from local files
var images = [SKLocalPhoto]()
let photo = SKLocalPhoto.photoWithImageURL("..some_local_path/150x150.png")
images.append(photo)

// 2. create PhotoBrowser Instance, and present.
let browser = SKPhotoBrowser(photos: images)
browser.initializePageIndex(0)
present(browser, animated: true, completion: {})

If you want to use zooming effect from an existing view, use another initializer:

// e.g.: some tableView or collectionView.
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
   let cell = collectionView.cellForItemAtIndexPath(indexPath)
   let originImage = cell.exampleImageView.image // some image for baseImage

   let browser = SKPhotoBrowser(originImage: originImage ?? UIImage(), photos: images, animatedFromView: cell)
   browser.initializePageIndex(indexPath.row)
   present(browser, animated: true, completion: {})
}

Custom

Toolbar

You can customize Toolbar via SKPhotoBrowserOptions.

SKPhotoBrowserOptions.displayToolbar = false                              // all tool bar will be hidden
SKPhotoBrowserOptions.displayCounterLabel = false                         // counter label will be hidden
SKPhotoBrowserOptions.displayBackAndForwardButton = false                 // back / forward button will be hidden
SKPhotoBrowserOptions.displayAction = false                               // action button will be hidden
SKPhotoBrowserOptions.displayHorizontalScrollIndicator = false            // horizontal scroll bar will be hidden
SKPhotoBrowserOptions.displayVerticalScrollIndicator = false              // vertical scroll bar will be hidden
let browser = SKPhotoBrowser(originImage: originImage, photos: images, animatedFromView: cell)

Colors

You can customize text, icon and background colors via SKPhotoBrowserOptions or SKToolbarOptions

SKPhotoBrowserOptions.backgroundColor = UIColor.whiteColor()               // browser view will be white
SKPhotoBrowserOptions.textAndIconColor = UIColor.blackColor()              // text and icons will be black
SKToolbarOptions.textShadowColor = UIColor.clearColor()                    // shadow of toolbar text will be removed
SKToolbarOptions.font = UIFont(name: "Futura", size: 16.0)                 // font of toolbar will be 'Futura'

Images

You can customize the padding of displayed images via SKPhotoBrowserOptions

SKPhotoBrowserOptions.imagePaddingX = 50                                   // image padding left and right will be 25
SKPhotoBrowserOptions.imagePaddingY = 50                                   // image padding top and bottom will be 25

Statusbar

You can customize the visibility of the Statusbar in browser view via SKPhotoBrowserOptions

SKPhotoBrowserOptions.displayStatusbar = false                             // status bar will be hidden

Close And Delete Buttons

That how you can customize close and delete buttons

SKPhotoBrowserOptions.displayDeleteButton = true                           // delete button will be shown
SKPhotoBrowserOptions.swapCloseAndDeleteButtons = true                     // now close button located on right side of screen and delete button is on left side
SKPhotoBrowserOptions.closeAndDeleteButtonPadding = 20                     // set offset from top and from nearest screen edge of close button and delete button

Custom Cache From Web URL

You can use SKCacheable protocol if others are adaptable. (SKImageCacheable or SKRequestResponseCacheable)

e.g. SDWebImage

// 1. create custom cache, implement in accordance with the protocol
class CustomImageCache: SKImageCacheable { var cache: SDImageCache }

// 2. replace SKCache instance with custom cache
SKCache.sharedCache.imageCache = CustomImageCache()

CustomButton Image

Close, Delete buttons are able to change image and frame.

browser.updateCloseButton(UIImage())
browser.updateUpdateButton(UIImage())

Delete Photo

You can delete your photo for your own handling. detect button tap from removePhoto delegate function.

Photo Captions

Photo captions can be displayed simply bottom of PhotoBrowser. by setting the caption property on specific photos:

let photo = SKPhoto.photoWithImage(UIImage())
photo.caption = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."

SwipeGesture

vertical swipe can enable/disable:

SKPhotoBrowserOptions.disableVerticalSwipe = true

Delegate

There's some trigger point you can handle using delegate. those are optional. See SKPhotoBrowserDelegate for more details.

  • didShowPhotoAtIndex(_ index:Int)
  • willDismissAtPageIndex(_ index:Int)
  • willShowActionSheet(_ photoIndex: Int)
  • didDismissAtPageIndex(_ index:Int)
  • didDismissActionSheetWithButtonIndex(_ buttonIndex: Int, photoIndex: Int)
  • didScrollToIndex(_ index: Int)
  • removePhoto(_ browser: SKPhotoBrowser, index: Int, reload: (() -> Void))
  • viewForPhoto(_ browser: SKPhotoBrowser, index: Int) -> UIView?
  • controlsVisibilityToggled(_ browser: SKPhotoBrowser, hidden: Bool)
let browser = SKPhotoBrowser(originImage: originImage, photos: images, animatedFromView: cell)
browser.delegate = self

// MARK: - SKPhotoBrowserDelegate
func didShowPhotoAtIndex(_ index: Int) {
// when photo will be shown
}

func willDismissAtPageIndex(_ index: Int) {
// when PhotoBrowser will be dismissed
}

func didDismissAtPageIndex(_ index: Int) {
// when PhotoBrowser did dismissed
}

Options

You can access via SKPhotoBrowserOptions, which can use for browser control. See SKPhotoBrowserOptions for more details.

  • single tap handling, dismiss/noaction
  • blackArea handling which is appearing outside of photo
  • bounce animation when appearing/dismissing
  • text color, font, or more
SKPhotoBrowserOptions.enableZoomBlackArea    = true  // default true
SKPhotoBrowserOptions.enableSingleTapDismiss = true  // default false

Photos from

License

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

Contributors

Thanks goes to these wonderful people (emoji key):


Oreo Chen

💻

Alexander Khitev

💻

K Rummler

💻

Mads Bjerre

💻

Meng Ye

💻

_ant_one

💻

Tim Roesner

💻

胥冥

💻

Kevin Wolkober

💻

PJ Gray

💻

ghysrc

💻

Josef Doležal

💻

Mark Goody

💻

Philippe Riegert

💻

Bryan Irace

💻

dirtmelon

💻

Heberti Almeida

💻

Felix Weiss

💻

.Some

💻

Onur Var

💻

Andrew Barba

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

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].