-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
2,132 additions
and
2,363 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
222 changes: 112 additions & 110 deletions
222
DKCarouselViewDemo/DKCarouselViewDemo.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
307 changes: 94 additions & 213 deletions
307
DKCarouselViewDemo/SDWebImage/README.md
100755 → 100644
Large diffs are not rendered by default.
Oops, something went wrong.
124 changes: 0 additions & 124 deletions
124
DKCarouselViewDemo/SDWebImage/SDWebImage/MKAnnotationView+WebCache.h
This file was deleted.
Oops, something went wrong.
135 changes: 0 additions & 135 deletions
135
DKCarouselViewDemo/SDWebImage/SDWebImage/MKAnnotationView+WebCache.m
This file was deleted.
Oops, something went wrong.
37 changes: 22 additions & 15 deletions
37
DKCarouselViewDemo/SDWebImage/SDWebImage/NSData+ImageContentType.h
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,33 @@ | ||
// | ||
// Created by Fabrice Aneche on 06/01/14. | ||
// Copyright (c) 2014 Dailymotion. All rights reserved. | ||
// | ||
/* | ||
* This file is part of the SDWebImage package. | ||
* (c) Olivier Poitrey <rs@dailymotion.com> | ||
* (c) Fabrice Aneche | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "SDWebImageCompat.h" | ||
|
||
typedef NS_ENUM(NSInteger, SDImageFormat) { | ||
SDImageFormatUndefined = -1, | ||
SDImageFormatJPEG = 0, | ||
SDImageFormatPNG, | ||
SDImageFormatGIF, | ||
SDImageFormatTIFF, | ||
SDImageFormatWebP | ||
}; | ||
|
||
@interface NSData (ImageContentType) | ||
|
||
/** | ||
* Compute the content type for an image data | ||
* Return image format | ||
* | ||
* @param data the input data | ||
* @param data the input image data | ||
* | ||
* @return the content type as string (i.e. image/jpeg, image/gif) | ||
* @return the image format as `SDImageFormat` (enum) | ||
*/ | ||
+ (NSString *)sd_contentTypeForImageData:(NSData *)data; | ||
|
||
@end | ||
|
||
|
||
@interface NSData (ImageContentTypeDeprecated) | ||
|
||
+ (NSString *)contentTypeForImageData:(NSData *)data __deprecated_msg("Use `sd_contentTypeForImageData:`"); | ||
+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; | ||
|
||
@end |
47 changes: 22 additions & 25 deletions
47
DKCarouselViewDemo/SDWebImage/SDWebImage/NSData+ImageContentType.m
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
// | ||
// Created by Fabrice Aneche on 06/01/14. | ||
// Copyright (c) 2014 Dailymotion. All rights reserved. | ||
// | ||
/* | ||
* This file is part of the SDWebImage package. | ||
* (c) Olivier Poitrey <rs@dailymotion.com> | ||
* (c) Fabrice Aneche | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
#import "NSData+ImageContentType.h" | ||
|
||
|
||
@implementation NSData (ImageContentType) | ||
|
||
+ (NSString *)sd_contentTypeForImageData:(NSData *)data { | ||
+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { | ||
if (!data) { | ||
return SDImageFormatUndefined; | ||
} | ||
|
||
uint8_t c; | ||
[data getBytes:&c length:1]; | ||
switch (c) { | ||
case 0xFF: | ||
return @"image/jpeg"; | ||
return SDImageFormatJPEG; | ||
case 0x89: | ||
return @"image/png"; | ||
return SDImageFormatPNG; | ||
case 0x47: | ||
return @"image/gif"; | ||
return SDImageFormatGIF; | ||
case 0x49: | ||
case 0x4D: | ||
return @"image/tiff"; | ||
return SDImageFormatTIFF; | ||
case 0x52: | ||
// R as RIFF for WEBP | ||
if ([data length] < 12) { | ||
return nil; | ||
if (data.length < 12) { | ||
return SDImageFormatUndefined; | ||
} | ||
|
||
NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; | ||
if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { | ||
return @"image/webp"; | ||
return SDImageFormatWebP; | ||
} | ||
|
||
return nil; | ||
} | ||
return nil; | ||
} | ||
|
||
@end | ||
|
||
|
||
@implementation NSData (ImageContentTypeDeprecated) | ||
|
||
+ (NSString *)contentTypeForImageData:(NSData *)data { | ||
return [self sd_contentTypeForImageData:data]; | ||
return SDImageFormatUndefined; | ||
} | ||
|
||
@end |
Oops, something went wrong.