Latest 1.0.2
Homepage https://github.com/IMcD23/IMRemoteImageSize
License MIT
Platforms ios 8.3, requires ARC
Authors

CI Status
Version
License
Platform

IMRemoteImageSize is a simple library for iOS that allows you to retrieve the dimensions of a remote image (JPG, GIF, PNG or BMP), without having to download the image. It retrieves the first few bytes of the file and then stops downloading.

Usage

IMRemoteImageSize runs as an extension of UIImage. To retrieve the size of a remote image, all you have to do is the following:

At the top of your Swift file, add import IMRemoteImageSize, then add this code to get the size of an image:

let url = NSURL(...) // image url
UIImage.getImageSize(url, completion: { (size) -> Void in
    print("Got size of image: (url): (size)")
})

If the size was unable to be determined by the library, it will return CGSizeZero.

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Written in Swift 2.0, so it requires at least Xcode 7. Compatible with iOS 8.3 and above.

Installation

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

pod "IMRemoteImageSize"

Author

Ian McDowell, [email protected]

License

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

Latest podspec

{
    "name": "IMRemoteImageSize",
    "version": "1.0.2",
    "summary": "a library for iOS that allows you to retrieve the size of a remote image without having to download it.",
    "description": "IMRemoteImageSize is a simple library for iOS that allows you to retrieve the dimensions of a remote image (JPG, GIF, PNG or BMP), without having to download the image. It retrieves the first few bytes of the file and then stops downloading.",
    "homepage": "https://github.com/IMcD23/IMRemoteImageSize",
    "license": "MIT",
    "authors": {
        "Ian McDowell": "[email protected]"
    },
    "source": {
        "git": "https://github.com/IMcD23/IMRemoteImageSize.git",
        "tag": "1.0.2"
    },
    "social_media_url": "https://twitter.com/ian_mcdowell",
    "platforms": {
        "ios": "8.3"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "IMRemoteImageSize": [
            "Pod/Assets/*.png"
        ]
    }
}

Pin It on Pinterest

Share This