» » Large image loading optimization solution

 

Large image loading optimization solution

Author: bamboo06 on 4-12-2016, 00:35, views: 6402

11
We browse the page to load a large size picture, the picture size is relatively large, we will see the browser to load the picture from top to bottom when the picture will be displayed until the picture is complete on the page, so that the image from the blank area To fully loaded process is more unexpected, the user experience is relatively poor.

We use the solution is to first load a small thumbnail, it may only 1K or so, and according to the required size of fuzzy display, wait until the large size of the picture to download a good and then complete the show large picture. This gives the user the feeling is to load the fuzzy picture, and then become clear picture, picture loading process fluently, greatly improve the user experience.

HTML

We prepare a big picture, of course, it is as large as possible, may be a few hundred KB, or even on the MB. We also create a thumbnail, very small, probably 1kb or so, we can convert this thumbnail to Base64 picture, the following code, the data-antimoderate-idata attribute value is defined as base64 picture.
<img src="images/a.jpg" id="pic" style="width:800px; height:576px;" data-antimoderate-idata="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwODxAPDgwTExQUExMcGxsbHCAgICAgICAgICD/2wBDAQcHBw0MDRgQEBgaFREVGiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICD/wAARCAAsADwDAREAAhEBAxEB/8QAHAAAAQQDAQAAAAAAAAAAAAAAAwEEBQYAAgcI/8QANxAAAgECBAMFBAgHAAAAAAAAAQIDBBEABRIhBjFRBxMiQZEUFiNxJFJhYnKBsfAVMjOCwdHh/8QAGQEAAwEBAQAAAAAAAAAAAAAAAQIDAAQF/8QALBEAAgECBAUDAwUAAAAAAAAAAAECAxEEEhMxFCFBUWFxodEiMpFCgbHB8P/aAAwDAQACEQMRAD8A7LS1sdreIHy2x0XPOHgqFI8M6g9DjZjWM/igibSyhz1GAYf0udUDw6xIhj3BKnzBsRcdDibHQOqz2BAfZy4YfmMFIDZAzcfZbEW76ugkkA8EJkXxHl5YLsZXJP3kyzMIjLSNDPEh0q8YuCbC42wIoM5DNs/qL+GGK3pimUkeTct7Y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XxU9JEI07rUeZJJY8/TEakUtjooyzbjGCvkp6caEQ2XWCb31KxseeBDmJV7gfeKs9mMxiiaV+9LuQxuUjFjbVa/wAsUcDmdR2KxxLxnmixKaaKCmlE0K99GrF7M24+Izgc/IXw0UczqNlS49zjMJuJ6oiVolURqsaO+kDQOrE8z1xsqAptH//Z"> 


javascript
Js do not do the processing, we will see a slowly loading from top to bottom of the big picture. Fortunately, antimoderate.js helps us handle the loading problem and see how to use it.
<script src="antimoderate.js"></script> 
<script> 
    var img = document.getElementById('pic');  
    AntiModerate.process(img, img.getAttribute("data-antimoderate-idata")); 
</script> 

Antimoderate.js use the html5 canvans will be done to deal with the picture, priority loading thumbnails, and do fuzzy, when the big picture is downloaded to load the big picture shows the use of it greatly speed up the page open.

Category: Javascript / CSS / Plugins

Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.
<
  • 0 Comments
  • 0 Articles
14 February 2017 01:36

Jamesswele

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Глянь какая штука


банкротство подать

<
  • 0 Comments
  • 0 Articles
16 May 2017 04:27

Haydin

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
That was really comprehensive and amazing demo, did not realize it makes so much difference! No wonder the picture I put up on my essay writing services did not turn out to be so good. Anyways, I will be sure to take care of these measures the next time.

<
  • 0 Comments
  • 0 Articles
4 July 2017 10:03

jon

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
This is now not a problem any more as phantom 4 drone has taken place in this regard for the best images of a match because it was getting more difficult for the authorities to install that much cameras in the grounds.

<
  • 0 Comments
  • 0 Articles
24 August 2017 16:52

On Time Essay

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
The better than average picture and after that whole the show significant picture. This gives the customer the inclining is to stack the cushioned picture, and after that end up being clear picture. Read more at Essay Writing

<
  • 0 Comments
  • 0 Articles
3 September 2017 10:17

nxdcyyInoft

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
payday installment loans <a href="http://cashadvances2017.com"> payday loan online</a> <a href="http://cashadvances2017.com"> payday loans</a> what is a payday loan usa payday loans

<
  • 0 Comments
  • 0 Articles
25 October 2017 18:24

Assignment Services

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Giving an even-minded system to bolstering back perspectives to beneficiaries is a certain something, however, we should change over the criticism into the ideal results and frame an improvement design objectives a decision to go and in building the certainty to see them through. Assignment Services

That was truly extensive and the astounding demo did not understand it has so much effect! No big surprise the photo I set up on my exposition composing AssignmentLand I will make sure to deal with these measures whenever.

<
  • 0 Comments
  • 0 Articles
19 December 2017 06:31

ShawnDep

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
viagra online costa rica
<a href="http://thjsildenafiljkvc.com/#">viagra without a doctor prescription</a>
can you get a girl pregnant with viagra
viagra without prescription
buy online prescription viagra without
<a href="http://bfviagrajlu.com/#">viagra no script</a>
can you buy viagra online legally
viagra no script
take 50mg viagra

<
  • 0 Comments
  • 0 Articles
7 January 2018 00:22

AprilHic

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
casino games online
free casino slots
<a href="http://casinobablogames.com/">casino games online</a>
free casino games slot

<
  • 0 Comments
  • 0 Articles
9 January 2018 07:29

Soniahaw

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
free casino slot games
slots casino games
<a href="http://casinobablogames.com/">free slots casino games</a>
slotomania free slots

<
  • 0 Comments
  • 0 Articles
6 March 2018 11:54

JeffreyDAg

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
buy viagra legally uk
<a href="http://dnviagrarudfh.com/#">viagra without a doctor's prescription</a>
viagra sale northern ireland
viagra no prescription
viagra buy england
<a href="http://fdviagrakdgjfh.com/#">order viagra online</a>
buy cheap viagra online
buy viagra online
buy viagra uk boots

Information
Comment on the news site is possible only within (days) days from the date of publication.