Commit a087a082 by houweibin

1,图片获取方法补完。。

parent 5b9b3e13
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
return productImages; return productImages;
} }
for(BUYImageLink *imageLink in imageLinks){ for(BUYImageLink *imageLink in imageLinks){
NSString *productImage = [imageLink.sourceURL.absoluteString stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:@"o42yton8r.qnssl.com"]; NSString *productImage = imageLink.sourceURL.absoluteString;
[productImages addObject:productImage]; [productImages addObject:productImage];
} }
return productImages; return productImages;
...@@ -177,8 +177,7 @@ ...@@ -177,8 +177,7 @@
for(NSDictionary *imageLink in imageLinks){ for(NSDictionary *imageLink in imageLinks){
if(imageLink[@"src"]){ if(imageLink[@"src"]){
NSString *originalImage = imageLink[@"src"]; NSString *originalImage = imageLink[@"src"];
NSString *productImage = [originalImage stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain]; [productImages addObject:originalImage];
[productImages addObject:productImage];
} }
} }
return productImages; return productImages;
...@@ -217,18 +216,22 @@ ...@@ -217,18 +216,22 @@
[newImageUrl insertString:size atIndex:startRange.location+1]; [newImageUrl insertString:size atIndex:startRange.location+1];
} }
} }
return [NSString stringWithFormat:@"%@",newImageUrl];; return [newImageUrl stringByReplacingOccurrencesOfString:@"cdn.shopify.com" withString:Image_Domain];
} }
+(NSArray *)getImageWH:(NSInteger)ImageSize{ +(NSArray *)getImageWH:(NSInteger)ImageSize{
if(ImageSize == BigImage){ switch (ImageSize) {
return @[@"1000", @"1000"]; case BigImage:
}else if(ImageSize == SmallImage){ return @[@"1000", @"1000"];
return @[@"300", @"300"]; case SmallImage:
}else if(ImageSize == LowImage){ return @[@"300", @"300"];
return @[@"150", @"150"]; case LowImage:
}else{ return @[@"150", @"150"];
return @[@"500", @"500"]; case NormalImage:
return @[@"500", @"500"];
default:
return @[@"300", @"300"];
} }
} }
...@@ -236,6 +239,7 @@ ...@@ -236,6 +239,7 @@
NSArray *imageUrls = nil; NSArray *imageUrls = nil;
if(product){ if(product){
imageUrls = [self getImageArrayBySize:product ImageSize:ImageSize]; imageUrls = [self getImageArrayBySize:product ImageSize:ImageSize];
return imageUrls;
} }
return nil; return nil;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment