Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Image loading

Posted on 2011-09-05
9
Medium Priority
?
286 Views
Last Modified: 2012-05-12
I have a page with links to a lot of images.  I notice that when you click the image links some images paint from top to bottom, and others appear all at once but blurry, and then a half second later the image corrects to full resolution.

I wondering what controls the way the image loads and if I have any say about it.

Thanks
0
Comment
Question by:steva
  • 4
  • 4
9 Comments
 
LVL 22

Expert Comment

by:plusone3055
ID: 36484243
you dont really have any say about it.. the images loads by types and  IE JPG, GIF, ect ect and more importantly SIZE .. If you want ot have "control" ocer the resize them to the same size then it will load faster  
for the best consistency use Jpg Files
If they are large  
0
 
LVL 5

Expert Comment

by:wmadrid1
ID: 36484701
You maybe can do a javascript preload of the images,
or use a javascript as lightbox
http://www.lokeshdhakar.com/projects/lightbox2/
0
 

Author Comment

by:steva
ID: 36495697
Thanks for the input but that doesn't really answer my question.  I know if I preload images they'll snap in place, but the question is, when you don't preload them (there may not be time to  preload before the image is requested)  what causes some images to load in a two-step process ( blurry, then clear)  and others to scan themselves in?

Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 5

Expert Comment

by:wmadrid1
ID: 36496313
that's depends of how the web browser renders the images.
please tellme the web browser you are testing, and if in all these the results are the same
0
 

Author Comment

by:steva
ID: 36496628
I was using Firefox, and it renders some images the blurry/clear way and others it scans in.  IE and Chrome seem to always show black until  the image is loaded and then they show the image all at once.

Looking closer, it seems that images that are around 1MByte get the blurry/clear treatment in Firefox while the images that get scanned in are all over 2.8MB.  So I guess Firefox decides how to display  the image depending on the image's size, while the other browsers show you nothing until they have all of the image.  Actually, the other browsers show you nothing until they have about 1MB and then they show you that.  So for them,  the 2.8MB image appears in three progressive steps. Firefox, when it scans the image in, seems to read a small amount, maybe 50KBytes, displays that, reads another 50KB, etc.





0
 
LVL 5

Accepted Solution

by:
wmadrid1 earned 2000 total points
ID: 36499398
Ok, other option you could try, is AJAX
load the image and show it when load is complete

var img = $("<img />").attr('src', 'http://somedomain.com/image.jpg')
                      .load(function() {
                         if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
                             alert('broken image!');
                         } else {
                             $("#something").append(img);
                         }
                      });

http://stackoverflow.com/questions/4285042/can-jquery-ajax-load-image
0
 

Author Comment

by:steva
ID: 36499628
Ajax is a great idea!  In my web development I keep going up to doors marked "AJAX" but then I find another way to do it instead of going through the door.  And here I am again.  Sooner or later I know I need to add AJAX to my toolbox and your code and reference is a great way to start.  Thanks.

I'll give you the points.

By the way, this is a little off topic, but you seem to have some experience with images, so I thought I would throw it out and see what your thougts are.  I know it's recommended that you resize images before you download them to a browser because external programs (e.g., IrfanView) do a better job of resizing than browsers do, plus, if you resize beforehand you benefit from a smaller load and less processing time spent in the browser.  BUT,  if you've built a fluid websit, such that when you resize the page the images and divs all shrink or grow  proportionately, the image gets resized anyway by the browser.  And when you resize a resized image I find that the result is not as crisp as when you just resize once. So I'm thinking that if you want to end up with  the crispest image and you have a fluid page design, you should not resize first, but download the larger original image and let the browser resize it just once.  Any thoughts?

Thanks for your help.
0
 
LVL 5

Expert Comment

by:wmadrid1
ID: 36502640
I am not an expert on images.
When working with web apps, we depend of web browsers. Also we can make some framework to try manage the images, dowloading them in background, but always will be some problem in some web browser.

I can recommend you try the AJAX with JQuery
http://jquery.com/
It's free and can help you with the javascript and AJAX easy use, also have some interesting plugins .
0
 

Author Comment

by:steva
ID: 36502989
Thanks.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question