Make it clear please
jbarros35 opened this issue · 1 comments
jbarros35 commented
I don't understand your samples, most of us just want get image from URL and convert it for displaying. Your samples are not clear enough to allow us to do that.
I need something like that
if let _ = downloadUrl, let url = URL(string: downloadUrl!) {
if let imageSource = CGImageSourceCreateWithURL(url as CFURL, nil) {
let scale = UIScreen.main.scale
let options: [NSString: Any] = [
kCGImageSourceThumbnailMaxPixelSize:
max(self.contentView.layer.bounds.width, self.contentView.layer.bounds.height) as NSObject,
kCGImageSourceCreateThumbnailFromImageAlways: true
]
if let imgref = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) {
let scaledImage = UIImage(cgImage: imgref, scale: scale, orientation: .up)
self.image.image = scaledImage
self.image.snp.makeConstraints({
$0.width.equalToSuperview()
})
}
}
So, how can I put a URL here and how to convert it ?
ainame commented
@jbarros35 This library doesn't make your case easy. I think this library only helps you in the case where you build an image-processing app using WebP format. I recommend that you use SDWebImage that support WebP format obediently.