UIWebView loading partial images - iphone

In my UIWebView I am loading html page from document directory. The html page contain most of the images. But when I tried to load that page, it displays partial images, some images are cropped & it shows grey area. I have tried to cache the images but still I am facing the same issue. The dimension of the images are near about 512x673 & size is 100KB with 70dpi.
I can't find the exact issue.
Please reply if anyone have idea.
Thanks in advance.

Related

Is there anyway to increase the load time of a web page due to image quality?

Are there any web tricks to speed up the loading of a web page. I have a few pages where I have images which were created in photoshop, but they are saved as a PNG. The load time is fairly slow of the page due to this, is there anyway to speed up a page load? They are in the region of 1.2/1.5MB
Reducing the size of the file would be a significant advantage.
Additionally converting the asset to webp for Chrome and Firefox, jp2 for Safari and falling back to png would help retain quality while reducing file size.
If the image isn’t in the first viewport you can also try lazy loading the image with something like lazysizes or at the very least the loading attribute.
You could compress the images using an online tool. Although, this may slightly reduce the quality.
I’ve used this site before: https://tinypng.com/
Other than that, I’m not sure if you can “speed up” the load time for a webpage.
You can check your website images here
https://www.imghaste.com/pagespeed/
1.2 to 1.5MB for each image is way large.
You need to adopt a process where you can optimize/shrink images for your website.
If you don't really need the images to be PNG you can always convert them to JPEG.
https://www.imghaste.com/converter

UIWebView: some images not loading

Good day.
I have a UIWebView that loads a big article with 10+ images. HTML code is stored locally, images are loaded by UIWebView automatically.
Sometimes web view won't load all of the images (for example, 3 out of 10). It doesn't depend on a connection type (EDGE/WiFI), image amount (sometimes web view loads 20 out of 20 images, sometimes doesn't load 3 out of 5).
As for now the only way to fix this as I understand is parsing <img> tags in HTML and loading images programmatically to a local cache for future displaying.
Any thoughts? Is there any way to control UIWebView's image loading?
Thank you.
I've recently had the same issue on another project: some images were displaying as half black only on slow connections like GPRS/EDGE. The reason was that my client's web server had a limit for connection time when downloading images. If you've run into similar issue don't forget to check that.

question regarding <img> and thumbnails

I have a photo site which renders previews of my photos in a tag when i hover some dots. (see http://johanberntsson.se/photo/).
But it feels kinda stupid to load the full image in to an img-tag. Because as far as i know, theres no difference between loading the image with its original size versus adding height and width attributes to it.
Got any suggestions how to improove my preview function?
Thanks
As far as client side is concerned, there's nothing you can do. If you're worried about how long it takes the image to load, you could always pre-load them with javascript. The only other thing would be to create a few sizes of your image on the server.
You should resize the image to get better speed. Here's an example in php
//Blob if image in database
$blob = mysql_fetch_...();
//else blob point to filename
$blob = "filename.jpg";
$gd = imagecreatefromstring($blob);
$resized = imagecreatetruecolor(X, Y); // new image dimensions
imagecopyresampled(....);
imagejpeg($resized);
Loading all the thumbnails in a giant sprite image used as a background image. Then position the background a the right place to have the right image a the right place.
This will improve the loading speed by loading only 1 image and allow the browser to cache the request of the image so, next time the user come to your site, it will load pretty fast.

Loading PDFs or Images from URL into a CoverFlow view

I want to load PDFs or Images into a View, but when the source is an URL there might be connection lags, so I wonder what is the best approach when loading content (like magazines) into a Coverflow view in the iPhone?.
(For Coverflow, something like this: http://apparentlogic.com/openflow/ )
Is it ok to get a pdf file then
obtain corresponding page images and
show them in an appropriate
resolution a Coverflow view?
(Downloading the hole PDF might take
long)
Or is better to download images as
needed and then pass them to the
Coverflow? (Although resolution
might be a problem, hence maybe I
wil need more than one image per
page)
Would it be better to have a pdf
file for every page?(So they can be
rendered at any resolution and I
don't have to download the hole file
at once)
I hope you can give some advices on this.
Thanks in advance.
Just for the record:
After some research I came up with images approach. They are the simpler, fastest, and reasonable good resolution. They can be loaded in 2 stages, regular resolution and better resolution for zooming, etc.

SVG file render image in smaller size

I am working for the first time with SVG files. I an able to load SVG files on webview but the images are rendering smaller than the original.
they are getting shrinked by a particular factor...... Is there some solution to my problem??? pls help.
Thank You
Meet bhatha
Have you set the UIWebView to Scale To Fit?
Pretty old question, but it is solved applying some javascript magic. Please read this post: UIWebView with just an image that should fit the whole view