Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
The method and system that embodiments of the invention provide a kind of speeding up picture to show on webpage.
For the advantage that makes technical solution of the present invention is clearer, the present invention is elaborated below in conjunction with drawings and Examples.
The method that embodiments of the invention provide a kind of speeding up picture to show on webpage can realize the quick demonstration of picture on webpage in mode cheaply.
Embodiment one
As shown in Figure 1, the method that described speeding up picture shows on webpage, when described former picture before showing on the webpage, described method comprises:
S101, making viewing area, described viewing area is the actual zone that can show of webpage;
S102, described former picture is judged,, then made and the big or small identical fixedly figure layer of described former dimension of picture if described former picture be big figure or many figure;
S103, the little figure of the pseudo-background of making, the little figure of described pseudo-background is the picture that takes up room much smaller than former picture, is used to support described fixedly figure layer;
S104, the background of described former picture is made as the little figure of described pseudo-background, generates new figure layer, place on the described fixedly figure layer, and the path of preserving former picture;
S105, described new figure layer is embedded described viewing area;
S106, judge whether described new figure layer is positioned at described viewing area, if be positioned at described viewing area, judge then whether the described new figure layer path that enters the viewing area is the path of former picture, if not the path of former picture, then the little figure of described pseudo-background is replaced with former picture, and with the described new figure layer buffer memory that enters the viewing area.
The method that the embodiments of the invention speeding up picture shows on webpage is written into a little figure of pseudo-background in advance, and notifies the user to wait for, the strategy that adopts cutting compression figure and branch to be written into accurately is written into required big figure or many figure according to the needs of showing.Compared with prior art, the user does not need to accelerate the display speed of picture on webpage by promoting modes such as server performance and purchase Add-ons, and to unwanted part or picture, server will can not send to client, thereby effectively saved bandwidth, reduced cost.
Embodiment two
Present embodiment provides when the described picture method that speeding up picture shows on webpage during for big figure, and wherein, the size that described big figure be a picture is above the viewing area, and perhaps the disk space that takies of picture is greater than or equal to 100k.In the present embodiment, the form of described picture can not be discerned by web browser.
As shown in Figure 2, the specific implementation process of this embodiment comprises:
S201, making viewing area, described viewing area is the actual zone that can show of webpage;
S202, described former picture is judged, if described former picture be big figure, the making fixedly figure layer identical then with described former picture size;
S203, described former picture is converted to the form that web browser can be discerned;
Wherein, need guarantee that described picture is the picture format that can be discerned by web browser, for example: gif, jpg, png etc., if extended formatting, then needing the format conversion with described picture is above-mentioned form.
S204, be many little figure with described former picture cutting;
Wherein, when the little figure of cutting, must guarantee that described picture is smaller, the disk space that takies is 10k to 50k, so that described little figure can be quick-downloading under any network condition.Because the present invention is in order to accelerate the display speed of picture on webpage, the user can be according to the server performance and the network bandwidth of oneself, the big figure of suitable cutting, and be compressed into the picture format that web browser can be discerned.For those has been little figure or the picture that is of moderate size, does not then need to carry out cutting.
S205, the little figure of the pseudo-background of making;
Wherein, the little figure of described pseudo-background must be enough little, and the disk space that takies is less than or equal to 5k, and the little figure of described pseudo-background will be fit to tiling, compression and stretching.
S206, make little figure layer, and described little figure is spliced, place on the described fixedly figure layer, the background of described little figure layer is made as the little figure of described pseudo-background according to the size of described little figure, and the path of preserving former picture;
The little figure that segments is spliced according to former big figure cutting order, make the html container of same size, for example div, p, span etc., the background of these containers is set at pseudo-figure; Make the html container of viewing area then, for example div, body, iframe etc. embed into the described figure layer of making.
S207, described little figure layer is embedded described viewing area;
S208, judge whether described little figure layer is positioned at described viewing area;
Wherein, the described step of judging whether described little figure layer is positioned at described viewing area comprises:
S208a, the real-time coordinate that imports the viewing area into and the parameter of size;
The real-time coordinate and the size of S208b, the described little figure layer of calculating;
The four real-time point coordinate of S208c, calculating viewing area, and four point coordinate of little figure layer;
S208d, judge whether any point in four point coordinate of described little figure layer is positioned at the interval of four point coordinate of described viewing area, if then described little figure layer is positioned at described viewing area.
S209, if described little figure layer be not positioned at described viewing area, then do not replace former picture;
S210, if described little figure layer be positioned at described viewing area, judge then whether the described little figure layer path that enters the viewing area is the path of former picture;
Wherein, describedly judge that whether the described little figure layer path that enters the viewing area be that the step in the path of former picture comprises:
S210a, import the image parameter of the little figure layer that enters the viewing area into;
S210b, obtain the path values of the current display picture of described little figure layer;
S210c, the path values of described current display picture and the path values of storage are compared, if unequal, the then described little figure layer path that enters the viewing area is not the path of former picture.
S211, if the described little figure layer path that enters the viewing area is not the path of former picture, then the little figure of described pseudo-background is replaced with little picture, and with the described little figure layer buffer memory that enters the viewing area;
S212, the mobile or described viewing area of rolling are carried out step S208 again;
S213, if the described little figure layer path that enters the viewing area be the path of former picture, then do not replace little picture.
Embodiment three
Present embodiment provides the method that speeding up picture shows when described picture is many figure on webpage.Wherein, the form of described many figure can not be discerned by web browser.As shown in Figure 3, the specific implementation process of this embodiment comprises:
S301, making viewing area, described viewing area is the actual zone that can show of webpage;
S302, described former picture is judged, if described former picture be many figure, the making fixedly figure layer identical then with described former picture size;
S303, described former picture is converted to the form that web browser can be discerned;
Wherein, need guarantee that described picture is the picture format that can be discerned by web browser, for example: gif, jpg, png etc., if extended formatting, then needing the format conversion with described picture is above-mentioned form.
S304, the little figure of the pseudo-background of making;
Wherein, the disk space that takies of the little figure of described pseudo-background is less than or equal to 5k.
S305, the path of described many figure all is made as the path of the little figure of described pseudo-background, the size of described many figure is made as the size of former picture, generate new figure layer, place on the described fixedly figure layer, and the path of preserving former picture;
S306, described new figure layer is embedded described viewing area;
S307, judge whether described new figure layer is positioned at described viewing area;
Wherein, the described step S208 that judges whether described new figure layer is positioned at described viewing area comprises:
S307a, the real-time coordinate that imports the viewing area into and the parameter of size;
The real-time coordinate and the size of S307b, the described new figure layer of calculating;
The four real-time point coordinate of S307c, calculating viewing area, and four point coordinate of new figure layer;
S307d, judge whether any point in four point coordinate of described new figure layer is positioned at the interval of four point coordinate of described viewing area, if then described new figure layer is positioned at described viewing area.
S308, if described new figure layer be not positioned at described viewing area, then do not replace former picture;
S309, if described new figure layer be positioned at described viewing area, judge then whether the described new figure layer path that enters the viewing area is the path of former picture;
Wherein, describedly judge that whether the described new figure layer path that enters the viewing area be that the step in the path of former picture comprises:
S309a, import the image parameter of the new figure layer that enters the viewing area into;
S309b, obtain the path values of the current display picture of described new figure layer;
S309c, the path values of described current display picture and the path values of storage are compared, if unequal, the then described new figure layer path that enters the viewing area is not the path of former picture.
S310, if the described new figure layer path that enters the viewing area is not the path of former picture, then the little figure of described pseudo-background is replaced with former picture, and with the described new figure layer buffer memory that enters the viewing area;
S311, the mobile or described viewing area of rolling are carried out step S307 again;
S312, if the described new figure layer path that enters the viewing area be the path of former picture, then do not replace former picture.
Thereby the method for utilizing the embodiments of the invention speeding up picture to show on webpage can realize the quick demonstration of picture on webpage in mode cheaply.
Embodiment four
Present embodiment provides the method that speeding up picture shows when described picture is how little figure on webpage.As shown in Figure 4, the specific implementation process of this embodiment comprises:
S401, making viewing area, described viewing area is the actual zone that can show of webpage;
S402, described former picture is judged,, then will described how little figure be synthesized one and put in order and scheme according to a graded if described former picture is how little figure;
Wherein, described how little figure is the picture that the disk space that takies is less than or equal to 5k, and the disk space that described whole figure takies is between 20k to 50k.
S403, with described whole figure adjust to can be quick-downloading scope;
S404, import the position coordinates and the display size parameter that need Show Picture into, the full-size(d) that picture is set is the dimensional parameters that imports into;
S405, described picture is navigated to position coordinates;
S406, described position coordinates moved to the top of viewing area.
The method that the embodiments of the invention speeding up picture shows on webpage, undersized picture is synthesized a whole figure, with described whole figure adjust to can be quick-downloading scope, and import position coordinates and the display size parameter that need to show into, position and move to the viewing area to described.Compared with prior art, the present invention can accelerate the display speed of undersized picture on webpage, has effectively saved the network bandwidth, has reduced cost.
The system that embodiments of the invention also provide a kind of speeding up picture to show on webpage can realize the quick demonstration of picture on webpage in mode cheaply.
Embodiment one
Present embodiment provide when described former picture for big figure or when scheming more, the system that speeding up picture shows on webpage.
As shown in Figure 5, the system that described speeding up picture shows on webpage comprises:
First production unit 501 is used to make the viewing area, and described viewing area is the actual zone that can show of webpage;
Judging unit 502 is used to judge that described former picture is for scheming greatly, scheming or how little figure more;
Second production unit 503 is used for judging that at described judging unit 502 described former picture for big figure or when scheming, makes and the big or small identical fixedly figure layer of described former dimension of picture more;
The 3rd production unit 504 is used to make the little figure of pseudo-background, and the little figure of described pseudo-background is the picture that takes up room much smaller than former picture, is used to support described fixedly figure layer;
Generation unit 505 is used for the background of described former picture is made as the little figure of described pseudo-background, generates new figure layer, places on the described fixedly figure layer;
Preserve unit 506, the path that is used to preserve former picture;
Embed unit 507, be used for described new figure layer is embedded described viewing area;
First judging unit 508 is used to judge whether described new figure layer is positioned at described viewing area;
Second judging unit 509 is used to judge whether the described new figure layer path that enters the viewing area is the path of former picture;
Processing unit 510 is used for the little figure of described pseudo-background is replaced with former picture, and with the described new figure layer buffer memory that enters the viewing area.
The system that the embodiments of the invention speeding up picture shows on webpage is written into a little figure of pseudo-background in advance, and notifies the user to wait for, the strategy that adopts cutting compression figure and branch to be written into accurately is written into required big figure or many figure according to the needs of showing.Compared with prior art, the user does not need to accelerate the display speed of picture on webpage by promoting modes such as server performance and purchase Add-ons, and to unwanted part or picture, server will can not send to client, thereby effectively saved bandwidth, reduced cost.
Wherein, as shown in Figure 5, when the form of described picture can not be discerned by web browser, described system also comprised:
Converting unit 511 is used for described former picture is converted to the form that web browser can be discerned.
As shown in Figure 5, when described former picture was big figure, described system also comprised:
Cutting unit 512, being used for described former picture cutting is many little figure;
Then described generation unit 505 according to the size construction drawing layer of described little figure, and splices described little figure, places on the described fixedly figure layer, and the background of described little figure layer is made as the little figure of described pseudo-background.
Wherein, when described former picture was many figure, described generation unit 505 all was made as the path of the little figure of described pseudo-background with the path of described many figure, and the size of described many figure is made as the size of former picture, generated new figure layer.
Wherein, the size that described big figure is a picture surpasses the viewing area, and perhaps the disk space that takies of picture is greater than or equal to 100k, and the disk space that described little figure takies is between 10k to 50k;
The disk space that the little figure of described pseudo-background takies is less than or equal to 5k.
Thereby the system that utilizes the embodiments of the invention speeding up picture to show on webpage can realize the quick demonstration of picture on webpage in mode cheaply.
Embodiment two
Present embodiment provide when described former picture for big figure or when scheming more, the system that speeding up picture shows on webpage.
As shown in Figure 6, the system that described speeding up picture shows on webpage comprises:
First production unit 601 is used to make the viewing area, and described viewing area is the actual zone that can show of webpage;
Judging unit 602 is used to judge that described former picture is for scheming greatly, scheming or how little figure more;
Synthesis unit 603 is used for when described judging unit 602 judges that described former picture is how little figure described how little figure being synthesized a whole figure according to a graded;
Adjustment unit 604, be used for described whole figure adjust to can be quick-downloading scope;
Unit 605 is set, is used to import into the position coordinates and the display size parameter that need Show Picture, the full-size(d) that picture is set is the dimensional parameters that imports into;
Positioning unit 606 is used for described picture is navigated to position coordinates;
Translation unit 607 is used for described position coordinates is moved to the top of viewing area.
The system that the embodiments of the invention speeding up picture shows on webpage, undersized picture is synthesized a whole figure, with described whole figure adjust to can be quick-downloading scope, and import position coordinates and the display size parameter that need to show into, position and move to the viewing area to described.Compared with prior art, the present invention can accelerate the display speed of undersized picture on webpage, has effectively saved the network bandwidth, has reduced cost.
The above; it only is the embodiment of the embodiment of the invention; but the protection domain of the embodiment of the invention is not limited thereto; anyly be familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, the protection domain of the embodiment of the invention should be as the criterion with the protection domain of claim.