Closed roma86 closed 8 years ago
Glad you like Siesta!
At a very quick glance, I’m guessing the problem is that S3 isn’t sending a content type for the image:
$ curl -I https://d3lpseitn39rtz.cloudfront.net/uploads/images/admin/ZdqrV5RKwKugOKu3HpeH7w.jpg
HTTP/1.1 200 OK
Content-Length: 231103
Connection: keep-alive
Date: Sun, 03 Apr 2016 19:32:02 GMT
Last-Modified: Wed, 23 Mar 2016 09:36:37 GMT
ETag: "a7247e54aa9aadbcd94ef8dfcdee311e"
Accept-Ranges: bytes
Server: AmazonS3
Age: 72
X-Cache: Hit from cloudfront
Via: 1.1 f8375738cc4acf5f5ea814a0efd10a17.cloudfront.net (CloudFront)
X-Amz-Cf-Id: gEPwvVZf_Uhu0o16kHL-aTfqLX8gSryLfkerjS0HJ2uTh-vXCN8F-Q==
By default, Siesta does not parse the data as an image unless the server says it’s an image. You need to either:
RemoteImageView
a Service
that’s configured to always apply image parsing no matter what the content type is.Let me know if that isn’t the problem, and we can dig in a little deeper.
Thank you for quick answer. I will try to find the right configuration for CloudFront if it is possible first. Also i got the point about Custom Service. Thank you one more time. Issue can be closed if it matter.
I’ll close it once we've tracked down the problem and verified that it's not a Siesta issue. So let me know!
I come back with update. S3 storage does not determine content-type for uploaded images by self.
Offtopic notes: This is not related for Siesta, but nevertheless. Clients should mark uploaded objects with appropriate content-type or it can be changed in s3 buckets interface manually for each file
Example for ruby aws-sdk
object_name = "uploads/images/#{img_name}"
obj = s3.bucket('demo_site').object(object_name)
obj.upload_file(temp_file_path, :content_type => file_content_type)
Issue not in Siesta, but noob as me can catch this, in reason AlamofireImage or SDWebImage successfully present image in UIImageView without warnings.
Thank you for help and for awesome library.
Thanks for the follow up!
Next round of Siesta work, I may add a little logging on the content type matching that will help the next person to encounter a problem like this more easily track the problem down.
Thank you for great library, i love siesta so much.
Today i cutch interesting issue with RemoteImageView, i am not clear is it problem of response from my aws cloudfront settings, or the extension.
This is what is go on.
This works fine:
But this do not display image
I check same urls with AlamofireImage library and both images are displayed, but Siesta's image extension does not.
My current configuration is
pod 'Siesta/Alamofire', '>=1.0-beta.6'
Debug log looks interesting
this is for image which is displayed
This is for AWS CloudFront
For me, noticeable difference in
Entity(content: <UIImage
andEntity(content: <OS_dispatch_data: data
is interesting part. But my knowledge in cocoa is as deep.Maybe this is incorrect settings in my CloudFront configuration, but in reason AlamofireImage extension get it right.
What do you think?