-
Re: how to get width and height of image with url?
Claude31 Feb 7, 2019 11:48 PM (in response to BurierA)Can you show what you do ?
When tyou say it is not fst, what is the impact for the end user ? Will he even notice ?
What about your older posts ? Are they solved ?
-
Re: how to get width and height of image with url?
BurierA Feb 8, 2019 12:41 AM (in response to Claude31)I need to adjust image dimensions depend height and width (originals) of image to imageView. when user click on a post, go to other controller show more details about this post, details include image of post that loaded from url. I used IGFastImage library but it's little slowly in fetch header of image and get dimensions.
my posts problems solved, but when navigate between tabbarItems and waitForConnectivity property of session, it's not solved yet. and I communicate with you soon about this proplems.
thanx bro, you always save my day.
-
Re: how to get width and height of image with url?
Claude31 Feb 8, 2019 4:55 AM (in response to BurierA)So, you need dimensions only when you go to present the detail of one view ?
Why don't you simply call the image size, like this
print("Image size", theImage.size)
Can you show the code where you load the image ?
For the other threads, don't forget to close them if done.
-
Re: how to get width and height of image with url?
BurierA Feb 8, 2019 12:10 PM (in response to Claude31)I want the original dimensions of image with a specific url
like this url of image
let ImageUrl = "https://cdn.dribbble.com/users/230091/screenshots/5983130/img_0031_2x.png"
when I implement the approach I want tell me this:
imageWidth = 800
imageHeigth = 600
try download this image in above url and you will understand what I mean.
thanx.
-
Re: how to get width and height of image with url?
OOPer Feb 8, 2019 8:16 PM (in response to BurierA)try download this image in above url and you will understand what I mean.
Trying with code, I cannot understand what you mean.
let imageUrl = URL(string: "...your ImageUrl here...")! here: do { let imageData = try Data(contentsOf: imageUrl) //You should not use this in app guard let image = UIImage(data: imageData) else { print("The content of the URL cannot be handled as an image") break here } print(image.size) //->(800.0, 600.0) } catch { print(error) }
If you eventually put the image into an imageView, downloading whole content would not be so bad. You have no need to use such slowly third party framework.
-
Re: how to get width and height of image with url?
BurierA Feb 9, 2019 3:25 AM (in response to OOPer)thanx bro for help.
I doing that by FTImageSize ibrary
by function FTImageSize.getImageSizeFromImageURL(url, perferdWidth: widthImageInBuilderInterface).
-
-
-
-
-