You are accessing the height and width immediately after setting the src attribute. You should wait for the image to load first.
You can detect if the image is getting loaded by checking the request url in the following delegate call.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
Once you know the image started loading, you can then get its height and width in the subsequent call to
- (void)webViewDidFinishLoad:(UIWebView *)webView