A kind of method, system and picture state server for inquiring about pictorial information
Technical field
The present invention relates to wireless Internet field, more particularly to a kind of method, system and picture shape for inquiring about pictorial information
State server.
Background technology
With wireless Internet and the development of intelligent terminal, increasing people begins to use mobile terminal to carry out internet
Access.When user is by mobile terminal accessing internet, the network address that can be accessed inside wireless search engine according to user, to net
The corresponding webpage in location carries out transcoding, original web page is carried out into typesetting again, and the picture in webpage is carried out into breviary processing, generation
It is adapted to the webpage that shows on mobile terminals and is transferred to mobile terminal to browse for user.
Prior art can judge whether the picture was carried out first in the transcoding of original web page, for the picture in webpage
Breviary processing, deterministic process is as follows:Picture state server can utilize three hash algorithm functions point to the network address of picture
Three offsets are not calculated, in each offset bit arrays corresponding with the hash algorithm for calculating it, are judged with the offset
Whether it is 1 as the array member corresponding to array member's subscript, if three corresponding number group memberships are 1, then it represents that
The picture breviary mistake, if any one array member is 0, then it represents that the picture does not have breviary mistake, therefore to this
Picture is handled and the array member in corresponding bit arrays using offset as array index is reset into 1 from 0.
At least there is problems with prior art:
Different network address is possible to obtain identical offset after calculating by hash algorithm in the prior art, that is, corresponds to
Can judge whether same array member is 1 in corresponding bit arrays, after first picture network address of judgement it is corresponding this
Value, when judging second picture network address, the value has been 1, and second picture network address institute can not be determined by causing hash-collision
Corresponding value is 0 or 1, causes to be mistaken for breviary mistake without the picture address that breviary is crossed originally, the picture when user browses
Normal presentation can not be obtained.
The content of the invention
The problem of in order to solve to judge the breviary of picture by accident during wireless search engine query graph piece state, the embodiment of the present invention
There is provided a kind of method, system and picture state server for inquiring about pictorial information.The technical scheme is as follows:
The embodiment of the present invention proposes a kind of method for inquiring about pictorial information, including:
Each barrel of pointer in bucket array of pointers, the bucket array of pointers is set to point to a chained list;
Obtain the network address of picture;
According to the network address of the picture, the key value of the network address for picture described in unique mark is calculated;
According to the key value of the network address of the picture, the figure is inquired about in the chained list that its corresponding bucket pointer is pointed to
The status information of piece.
As the preferred of above-mentioned technical proposal, the network address according to the picture is calculated for unique mark institute
The key value of the network address of picture is stated, is specifically included:
According to the network address of the picture, calculated using Message Digest Algorithm 5 MD5 algorithms for unique mark
The key value of the network address of the picture.
As the preferred of above-mentioned technical proposal, the key value of the network address according to the picture is corresponding at its
The status information of the picture is inquired about in the chained list that bucket pointer is pointed to, including:
According to the key value of the network address of the picture, corresponding bucket pointer is determined;
The chained list that the corresponding bucket pointer is pointed to is inquired about, will be every in the key value and chained list of the network address of the picture
The key value of the network address for the picture that one node is preserved is matched;
If the status information of the picture is inquired, and the picture then returns to the state letter of the picture by breviary
Breath;
If the status information of the picture is inquired, and the picture then returns to the state letter of the picture not by breviary
Breath, and breviary processing is carried out to the picture;
If not inquiring the status information of the picture, the configured information not inquired is returned, and according to the picture
The network address obtain the picture, breviary processing is carried out to the picture.
As the preferred of above-mentioned technical proposal, if the status information for inquiring the picture, and the picture not by
Breviary, then return to the status information of the picture, and after carrying out breviary processing to the picture, in addition to:
Update the status information of the picture in the node of status information of the picture is preserved, and by the picture
State is set to breviary.
As the preferred of above-mentioned technical proposal, if the status information for not inquiring the picture, returns and does not inquire about
The configured information arrived, and the picture is obtained according to the network address of the picture, after picture progress breviary processing,
Also include:
Apply for a node in the chained list of inquiry, preserve the status information of the picture, and by the state of the picture
It is set to breviary.
As the preferred of above-mentioned technical proposal, methods described also includes:
Preserve the time that the picture is queried recently, if the status information of the picture the time being queried recently it
Exceed preset time afterwards still without being queried, then deleted the node of the status information for preserving the picture.
The embodiment of the present invention also proposed a kind of picture state server, including:
Setup module, for setting each barrel of pointer in bucket array of pointers, the bucket array of pointers to point to a chained list;
Acquisition module, the network address for obtaining picture;
Computing module, for the network address according to the picture, calculates the network for picture described in unique mark
The key value of location;
Enquiry module, for the key value of the network address according to the picture, the chain pointed in its corresponding bucket pointer
The status information of the picture is inquired about in table.
As the preferred of above-mentioned technical proposal, the computing module, specifically for:
According to the network address of the picture, calculated using Message Digest Algorithm 5 MD5 algorithms for unique mark
The key value of the network address of the picture.
As the preferred of above-mentioned technical proposal, the enquiry module, including:
Determining unit, for the key value according to the picture, determines corresponding bucket pointer;
Query unit, for inquiring about the chained list that the corresponding bucket pointer is pointed to, by the pass of the network address of the picture
Key assignments is matched with the key value of the network address for the picture that each node is preserved in chained list;
Returning unit, if the status information for inquiring the picture, and the picture by breviary, then return is described
The status information of picture;Or,
If the status information for inquiring the picture, and the picture then returns to the shape of the picture not by breviary
State information, and the picture is sent to the progress breviary processing of picture breviary server;Or,
If the status information for not inquiring the picture, the configured information not inquired is returned, and by the figure
Piece is sent to picture breviary server, and the picture is obtained according to the network address of the picture, and breviary is carried out to the picture
Processing.
As the preferred of above-mentioned technical proposal, the picture state server also includes:
First preserving module, the state letter for updating the picture in the node of status information of the picture is preserved
Breath, and the state of the picture is set to breviary.
As the preferred of above-mentioned technical proposal, the picture state server also includes:
Second preserving module, for applying for a node in the chained list of inquiry, preserves the status information of the picture, and
The state of the picture is set to breviary.
As the preferred of above-mentioned technical proposal, the picture state server also includes:
Processing module, for preserving the time that the picture is queried recently, if the status information of the picture is nearest
Exceed preset time after the time being queried still without being queried, then by the node of the status information for preserving the picture
Deleted.
The embodiment of the present invention also proposed a kind of system for inquiring about pictorial information, including:Picture state server;Its feature
It is, the picture state server includes:
Setup module, for setting each barrel of pointer in bucket array of pointers, the bucket array of pointers to point to a chained list;
Acquisition module, the network address for obtaining picture;
Computing module, for the network address according to the picture, calculates the network for picture described in unique mark
The key value of location;
Enquiry module, for the key value of the network address according to the picture, the chain pointed in its corresponding bucket pointer
The status information of the picture is inquired about in table.
As the preferred of above-mentioned technical proposal, the system also includes:
Picture breviary server:For carrying out breviary processing to picture, browse operation is carried out to adapt to mobile terminal device;
Picture storage server:For preserving the picture after breviary processing.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:Pass through the network address of the picture to acquisition
Calculated, obtain uniquely key value corresponding with its network address, by being matched in the server to the key value, look into
Ask the status information of the picture in server, it is to avoid hash-collision can be produced in the prior art by checking during picture state, be caused
The problem of obtaining error message.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, makes required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing.
Fig. 1 is the method flow schematic diagram of the inquiry pictorial information provided in the embodiment of the present invention 1;
Fig. 2 is the method flow schematic diagram of the inquiry pictorial information provided in the embodiment of the present invention 2;
Fig. 3 is the structural representation of the picture state server provided in the embodiment of the present invention 3;
Fig. 4 is the system structure diagram of the inquiry pictorial information provided in the embodiment of the present invention 4.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention
Formula makees further state description.
Embodiment 1
The embodiment of the present invention 1 propose it is a kind of inquire about pictorial information method, its flow as shown in figure 1, including:
Step 101:Each barrel of pointer in bucket array of pointers, the bucket array of pointers is set to point to a chained list;
Step 102:Obtain the network address of picture;
Step 103:According to the network address of the picture, the pass of the network address for picture described in unique mark is calculated
Key assignments;
Step 104:According to the key value of the network address of the picture, looked into the chained list that its corresponding bucket pointer is pointed to
Ask the status information of the picture.
The embodiment of the present invention is calculated by the network address of the picture to acquisition, obtain uniquely with its network address pair
The key value answered, by being matched in the server to the key value, the status information of the picture in inquiry server, it is to avoid
Hash-collision can be produced by checking in the prior art during picture state, the problem of causing to obtain error message.
Embodiment 2
The embodiment of the present invention 2 propose it is a kind of inquire about pictorial information method, its flow as shown in Fig. 2 including:
Step 201:Each barrel of pointer in bucket array of pointers, the bucket array of pointers is set to point to a chained list.
The storage inside structure of picture state server is hash barrels of mode, sets a bucket array of pointers, and the bucket refers to
The lower label of pin array is from 0,1,2 ... serial numbers, and numbering is barrel number.One bucket pointer of each barrel number correspondence, each bucket
Each node that pointer is pointed in a chained list, chained list stores the status information of a pictures.The shape of the picture preserved in node
At least include in state information:The network address of picture, the original height of picture, the original width of picture, whether be rubbish picture,
Whether it is whether dead chain picture, picture the information such as cross by breviary.
Step 202:Obtain the network address of picture.
In wireless search engine, trans-coding system is in typesetting webpage again, and the network address of picture can be sent by running into picture
To picture state server, whether the various information and the picture of the picture are inquired about by breviary mistake.
Step 203:According to the network address of the picture, the pass of the network address for picture described in unique mark is calculated
Key assignments.
Specifically, according to the network address of picture, the key value of the network address of the picture being calculated using MD5 algorithms, is obtained
To the binary numeral of one 64, the network address one key value of unique correspondence of each picture.
Step 204:According to the key value of the network address of the picture, looked into the chained list that its corresponding bucket pointer is pointed to
Ask the status information of the picture.
Step 204 is specially:
Step 2041:According to the key value of the network address of the picture, corresponding bucket pointer is determined.
Specifically, according to the 64 of the picture network address key values, taking first 26 of the key value, being carried out numeration system
Formula is changed, and is the decimal system from Binary Conversion, obtains the ten's digit of one 8.
8 ten's digits that calculating is obtained are positioned as the network address of this picture in picture state server can
The subscript of bucket pointer in the barrel number of the status information of the picture, i.e. bucket array of pointers can be stored.The sum of bucket is 67108864,
It is by 2 26 powers are calculated Lai therefore the network address of any one picture can match corresponding bucket pointer for it.
, can be in subsequent treatment by the status information guarantor of this picture if picture state server does not store the status information of the picture
In the presence of on some node in the chained list pointed by the corresponding bucket pointer of this barrel number, therefore inquiry or storage or update
It is to navigate to this barrel of pointer first during the status information of picture.
Step 2042:The chained list that the corresponding bucket pointer is pointed to is inquired about, by the key value of the network address of the picture
Matched with the key value of the network address for the picture that each node is preserved in chained list.
The chained list pointed by bucket pointer is inquired about, by the figure that each node is preserved in the key value and chained list of the picture got
The key value of picture in the status information of piece is matched.Step 2043 or 2044 is according to circumstances performed if matching, if
Then execution step 2045 is not matched.
Step 2043:If the status information of the picture is inquired, and the picture then returns to the picture by breviary
Status information.
If the network address identical key value for the picture for matching and receiving in node, illustrates picture status service
The status information of this picture, and " whether picture is by breviary " field in the status information of the picture have been saved in device
State is by breviary state, then the status information of the picture in the node to be returned into trans-coding system.
Step 2044:If the status information of the picture is inquired, and the picture then returns to the picture not by breviary
Status information, and to the picture carry out breviary processing.
If the network address identical key value for the picture for matching and receiving in node, illustrates picture status service
Save the status information of this picture in device, but " whether picture by breviary " field in the status information of the picture
The status information of picture in the node is then returned to trans-coding system for not by breviary state by state, and by the net of the picture
Network address is sent to picture breviary server so that picture breviary server carries out breviary processing to the picture, performs step 205
To 207.
Step 2045:If not inquiring the status information of the picture, the configured information not inquired is returned, and according to
The network address of the picture obtains the picture, and breviary processing is carried out to the picture.
If any information for illustrating not preserving the picture in picture state server if not matching, therefore return to
The configured information that trans-coding system is not inquired, and the network address of the picture is sent to picture breviary server, perform step
Rapid 208 to 210.
Picture breviary server obtains the details of the picture and the picture simultaneously according to the network address of picture
Carry out breviary processing.The details of picture at least include:The network address of picture, the original height of picture, picture it is original
Width, whether be rubbish picture, whether be the information such as dead chain picture.
Step 205:Picture breviary server obtains the picture and the picture according to the network address of the picture
Details, and to the picture carry out breviary processing.
The details of picture at least include:The network address of picture, the original height of picture, the original width of picture,
Whether it is rubbish picture, whether is the information such as dead chain picture.
Step 206:The picture after breviary is preserved to picture storage server.
The network address of picture after breviary with picture is corresponding into one group of data, preserve to picture storage server.
Step 207:Update the status information of the picture in the node of status information of the picture is preserved, and by institute
" whether picture is by the breviary " field stated in the state of picture is set to breviary state.
After thumbnail pictures, picture breviary server returns the details of the network address of picture and the picture got
Back to picture state server, step 202 is carried out to picture to the operation of step 2041 according to the network address of picture, in picture state
The node for preserving the picture is found in server, and by the content of the status information of the picture in ancestor node, is updated to newly obtain
Content in the details for the picture got, i.e., the original height of the network address, picture to picture, the original width of picture
Spend, whether be rubbish picture, whether be that the information such as dead chain picture are updated.Simultaneously by picture status information " picture is
It is no by breviary " field is set to picture breviary state.
Step 208:Picture breviary server obtains the picture and the picture according to the network address of the picture
Details, and to the picture carry out breviary processing.
The details of picture at least include:The network address of picture, the original height of picture, the original width of picture,
Whether it is rubbish picture, whether is the information such as dead chain picture.
Step 209:The picture after breviary is preserved to picture storage server.
The network address of picture after breviary with picture is corresponding into one group of data, preserve to picture storage server.
Step 210:Apply for a node in the chained list of inquiry, preserve the status information of the picture, and by the figure
Whether the state being set to by breviary field is set to the state of breviary to piece.
The details of the network address of picture and the picture of acquisition are returned to picture state by picture breviary server
Server, picture state server is carried out after step 202 to the operation of step 2041 according to the network address of picture to picture, in chained list
In do not find key value identical node with the picture, therefore apply for a new section in current chained list for the picture
Point, and the content of details for the picture that picture breviary server is obtained is stored in this node, while by this node
In " whether picture by breviary " field be set to the state of picture breviary, the node is inserted to the end of current chained list, should
The various information of node are preserved as the status information of picture.
At least include in the status information of picture:The key value of picture, the network address of picture, the original height of picture,
The original width of picture, whether be rubbish picture, whether whether be dead chain picture, picture by information such as breviaries.
Further, it can also include:
Step 211:Preserve time for being queried recently of picture, if the status information of the picture be queried recently when
Between after exceed preset time still without being queried, then the node of the status information for preserving the picture is deleted.
In the query process that picture state server carries out picture status information, can also by each inquiry picture when
Between preserve in node, every time access all can be by this time information renovation once.Timing is carried out to this temporal information, when super
When crossing preset time, still without the access carried out to the pictorial information of this node again, then will be by this node from chain
Deleted in table, saved resource.
The embodiment of the present invention is calculated by the network address of the picture to acquisition, obtain uniquely with its network address pair
The key value answered, uniquely one node of correspondence preserves the status information of picture to this key value, it is to avoid hash-collision occur
The problem of, whether picture can be accurately judged by breviary mistake, while improving the usage experience of user.
Embodiment 3
The embodiment of the present invention 3 propose a kind of picture state server, its structure as shown in figure 3, including:
Setup module 301, for setting each barrel of pointer in bucket array of pointers, the bucket array of pointers to point to a chain
Table.
Acquisition module 302, the network address for obtaining picture.
Computing module 303, for the network address according to the picture, calculates the network for picture described in unique mark
The key value of address.
Wherein, computing module 303 specifically for:
According to the network address of the picture, calculated using Message Digest Algorithm 5 MD5 algorithms for unique mark
The key value of the network address of the picture.
Enquiry module 304, for the key value of the network address according to the picture, is pointed in its corresponding bucket pointer
The status information of the picture is inquired about in chained list.
Wherein, enquiry module 304, are specifically included:
Determining unit 3041, for the key value according to the picture, determines corresponding bucket pointer;
Query unit 3042, for inquiring about the chained list that the corresponding bucket pointer is pointed to, by the network address of the picture
The key value of the network address of picture that is preserved with each node in chained list of key value matched;
Returning unit 3043, if the status information for inquiring the picture, and the picture then returns by breviary
The status information of the picture;Or,
If the status information for inquiring the picture, and the picture then returns to the shape of the picture not by breviary
State information, and the picture is sent to the progress breviary processing of picture breviary server;Or,
If the status information for not inquiring the picture, the configured information not inquired is returned, and by the figure
Piece is sent to picture breviary server, and the picture is obtained according to the network address of the picture, and breviary is carried out to the picture
Processing.
Wherein, picture state server can also include:
First preserving module 305, the shape for updating the picture in the node of status information of the picture is preserved
State information, and the state of the picture is set to breviary.
Second preserving module 306, for applying for a node in the chained list of inquiry, preserves the state letter of the picture
Breath, and the state of the picture is set to breviary.
Processing module 307, for preserving the time that the picture is queried recently, if the status information of the picture is most
Exceed preset time after the time being closely queried still without being queried, then by the section of the status information for preserving the picture
Point is deleted.
The embodiment of the present invention is calculated by the network address of the picture to acquisition, obtain uniquely with its network address pair
The key value answered, uniquely one node of correspondence preserves the status information of picture to this key value, it is to avoid hash-collision occur
The problem of, whether picture can be accurately judged by breviary mistake, while improving the usage experience of user.
Embodiment 4
The embodiment of the present invention 4 propose it is a kind of inquire about pictorial information system, its structure as shown in figure 4, including:Picture shape
State server.
Wherein picture state server 401 includes:
Setup module 4011, for setting each barrel of pointer in bucket array of pointers, the bucket array of pointers to point to one
Chained list;
Acquisition module 4012, the network address for obtaining picture;
Computing module 4013, for the network address according to the picture, calculates the net for picture described in unique mark
The key value of network address;
Enquiry module 4014, for the key value of the network address according to the picture, is pointed in its corresponding bucket pointer
Chained list in inquire about the status information of the picture.
Wherein, the system of inquiry pictorial information also includes:
Picture breviary server 402:For carrying out breviary processing to picture, carry out browsing behaviour to adapt to mobile terminal device
Make.
Picture storage server 403:For preserving the picture after breviary processing.
The embodiment of the present invention is calculated by the network address of the picture to acquisition, obtain uniquely with its network address pair
The key value answered, by being matched in the server to the key value, the status information of the picture in inquiry server, it is to avoid
Hash-collision can be produced by checking in the prior art during picture state, the problem of causing to obtain error message.
One of ordinary skill in the art will appreciate that realizing that all or part of step of above-described embodiment can be by hardware
To complete, the hardware of correlation can also be instructed to complete by program, described program can be stored in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc. should be included in the scope of the protection.