Skip to content

Commit

Permalink
Fixed images with spaces in their file names not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
SpencerBaker committed Mar 26, 2015
1 parent 6aa504e commit a60c442
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion piwigo/AlbumImagesViewController.m
Expand Up @@ -272,7 +272,7 @@ -(void)downloadImage

UIImageView *dummyView = [UIImageView new];
__weak typeof(self) weakSelf = self;
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:downloadingImage.thumbPath]]
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[downloadingImage.thumbPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
weakSelf.downloadView.downloadImage = image;
Expand Down
2 changes: 1 addition & 1 deletion piwigo/AlbumTableViewCell.m
Expand Up @@ -351,7 +351,7 @@ -(void)setupWithAlbumData:(PiwigoAlbumData*)albumData
}
else
{
[self.backgroundImage setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageData.mediumPath]]
[self.backgroundImage setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[imageData.mediumPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {

Expand Down
2 changes: 1 addition & 1 deletion piwigo/AllCategoriesViewController.m
Expand Up @@ -171,7 +171,7 @@ -(void)setRepresenativeForCategoryId:(NSInteger)categoryId
category.albumThumbnailUrl = imgData.thumbPath;

UIImageView *dummyView = [UIImageView new];
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imgData.mediumPath]] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[imgData.mediumPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]] placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
category.categoryImage = image;
[[NSNotificationCenter defaultCenter] postNotificationName:kPiwigoNotificationCategoryImageUpdated object:nil];
} failure:nil];
Expand Down
2 changes: 1 addition & 1 deletion piwigo/ImageCollectionViewCell.m
Expand Up @@ -142,7 +142,7 @@ -(void)setupWithImageData:(PiwigoImageData*)imageData
return;
}

[self.cellImage setImageWithURL:[NSURL URLWithString:self.imageData.thumbPath] placeholderImage:[UIImage imageNamed:@"placeholder"]];
[self.cellImage setImageWithURL:[NSURL URLWithString:[self.imageData.thumbPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] placeholderImage:[UIImage imageNamed:@"placeholder"]];
self.nameLabel.text = imageData.name;

if(imageData.isVideo)
Expand Down
2 changes: 1 addition & 1 deletion piwigo/ImageDetailViewController.m
Expand Up @@ -191,7 +191,7 @@ -(void)downloadImage

UIImageView *dummyView = [UIImageView new];
__weak typeof(self) weakSelf = self;
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.imageData.thumbPath]]
[dummyView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[self.imageData.thumbPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
weakSelf.downloadView.downloadImage = image;
Expand Down
4 changes: 2 additions & 2 deletions piwigo/ImagePreviewViewController.m
Expand Up @@ -42,10 +42,10 @@ -(void)setImageWithImageData:(PiwigoImageData*)imageData
return;
}

UIImage *thumb = [[UIImageView sharedImageCache] cachedImageForRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageData.thumbPath]]];
UIImage *thumb = [[UIImageView sharedImageCache] cachedImageForRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[imageData.thumbPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];

__weak typeof(self) weakSelf = self;
[self.scrollView.imageView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageData.mediumPath]]
[self.scrollView.imageView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[imageData.mediumPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]
placeholderImage:thumb ? thumb : [UIImage imageNamed:@"placeholder"]
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
weakSelf.scrollView.imageView.image = image;
Expand Down
2 changes: 1 addition & 1 deletion piwigo/ImageScrollView.m
Expand Up @@ -47,7 +47,7 @@ -(void)setupPlayerWithURL:(NSString*)videoURL
self.maximumZoomScale = 1.0;
self.minimumZoomScale = 1.0;

self.player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:videoURL]];
self.player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:[videoURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
[self.player setControlStyle:MPMovieControlStyleDefault];
self.player.scalingMode = MPMovieScalingModeAspectFit;
self.player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Expand Down
4 changes: 2 additions & 2 deletions piwigo/ImageService.m
Expand Up @@ -205,7 +205,7 @@ +(AFHTTPRequestOperation*)downloadImage:(PiwigoImageData*)image
onFailure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))fail
{
if(!image) return nil;
NSURLRequest *requst = [NSURLRequest requestWithURL:[NSURL URLWithString:image.fullResPath]];
NSURLRequest *requst = [NSURLRequest requestWithURL:[NSURL URLWithString:[image.fullResPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:requst];
requestOperation.responseSerializer = [AFImageResponseSerializer serializer];
[requestOperation setCompletionBlockWithSuccess:completion
Expand All @@ -227,7 +227,7 @@ +(AFHTTPRequestOperation*)downloadVideo:(PiwigoImageData*)video
onFailure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))fail
{
if(!video) return nil;
NSURLRequest *requst = [NSURLRequest requestWithURL:[NSURL URLWithString:video.fullResPath]];
NSURLRequest *requst = [NSURLRequest requestWithURL:[NSURL URLWithString:[video.fullResPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];
AFHTTPRequestOperation *requestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:requst];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0] stringByAppendingPathComponent:video.fileName];
Expand Down

0 comments on commit a60c442

Please sign in to comment.