Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of in batches picture uploading to the method for network album, can shorten the uplink time of picture.
Another object of the present invention is to provide a kind of client, can shorten the uplink time of picture.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of in batches picture uploading comprises to the method for network album:
When client during to picture uploading instruction in batches, start simultaneously that M compression thread and N are individual to upload thread, described M and N are positive integer;
Described compression thread is treated each width of cloth picture of uploading and is compressed respectively processing, and the picture after will processing joins in the image cache pond;
Describedly upload each width of cloth picture that thread will join in the described image cache pond and upload in the network album respectively.
A kind of client comprises:
Described receiver module is used for notifying described processing module to carry out self function after receiving in batches picture uploading instruction;
Described processing module is used for after receiving the notice of described receiver module, starts simultaneously that M compression thread and N are individual to upload thread, and described M and N are positive integer; Wherein, described compression thread is used for each width of cloth picture to be uploaded is compressed respectively processing, and the picture after will processing joins in the image cache pond, describedly uploads each width of cloth picture that thread is used for joining described image cache pond and uploads in the network album respectively.
As seen, adopt technical scheme of the present invention, when needs carry out the batch picture uploading, client can start M compression thread and the individual thread of uploading of N simultaneously, compression thread and upload thread and carry out parallel processing, namely compressing thread treats each width of cloth picture of uploading and compresses respectively processing, and the picture after will processing joins in the image cache pond, simultaneously, uploading each width of cloth picture that thread will join in the image cache pond uploads to respectively in the network album, that is to say, when picture is compressed processing, namely uploading the picture of having handled well, when uploading the picture of having handled well, again untreated picture is compressed processing, thereby shortening widely the uplink time of picture.
Embodiment
For problems of the prior art, a kind of in batches picture uploading is proposed to the scheme of network album among the present invention, can shorten the uplink time of picture.
For make technical scheme of the present invention clearer, understand, referring to the accompanying drawing embodiment that develops simultaneously, scheme of the present invention is described in further detail.
Fig. 2 is that the present invention is with the flow chart of batch picture uploading to the embodiment of the method for network album.As shown in Figure 2, comprising:
Step 21: when client during to picture uploading instruction in batches, start simultaneously that M compression thread and N are individual to upload thread, M and N are positive integer.
When the user need to carry out the batch picture uploading, can send corresponding instruction to employed client, as clicking a certain button on the human-computer interaction interface, client starts the individual thread of uploading of M compression thread and N simultaneously after instruction.
M and N are positive integer, and concrete value all can be decided according to the actual requirements, and the value of M and N can be identical, also can be different.
Step 22: the compression thread is treated each width of cloth picture of uploading and is compressed respectively processing, and the picture after will processing joins in the image cache pond; Uploading each width of cloth picture that thread will join in the image cache pond uploads in the network album respectively.
In this step, under the prerequisite that keeps certain definition, the compression thread is treated each width of cloth picture of uploading and is compressed respectively processing, and the picture after will processing joins in the image cache pond.
Mention, most of network album provider is in order to save the memory space of server before, all can require client with before picture uploading is in the server, under the prerequisite that keeps certain definition picture compressed first, to reduce the volume of picture.
Usually, server can issue an index to client, the volume requirement that is used for the every width of cloth picture after explanation is uploaded, such as not surpassing 0.5M, so, client can be according to the volume of each width of cloth picture to be uploaded, determine voluntarily to adopt which kind of compress mode, such as being the Lossless Compression mode, or the lossy compression method mode, or the mode that combines of Lossless Compression and lossy compression method.
Lossless Compression refers to adopt certain algorithm to represent the data message that repeats, and picture can reduce fully, can not affect image content, also can not make picture detail that loss is arranged; Lossy compression method then has certain change to picture, when preserving picture, kept more monochrome information, and the information of form and aspect and colorimetric purity and pixel are on every side merged, the ratio that merges is different, the ratio of compression is also different, because amount of information has reduced, so compression ratio can be very high, but picture quality also can correspondingly descend.
Than Lossless Compression, lossy compression method can be dwindled the picture volume better.
In actual applications, for each width of cloth picture to be uploaded, can be respectively by the difference between the picture volume of its actual volume relatively and server requirement, determine flexibly employing Lossless Compression mode or lossy compression method mode, or both modes of combining.
How to carry out Lossless Compression and lossy compression method is prior art.
The space size in image cache pond also can be decided according to the actual requirements, and is not restricted among the present invention.
In addition, when each width of cloth picture to be uploaded being compressed processing, usually can follow certain order, specifically follow which kind of order and be not restricted, can be preseted by the user.
Such as, the photo that each width of cloth picture to be uploaded is the user to be taken when once travelling so then can compress processing by the order after arriving first to each photos according to shooting time.
In compression when thread compresses processing, upload each width of cloth picture that thread will join in the image cache pond and upload in the network album respectively.
Usually, uploading thread can be uploaded in the network album respectively by each width of cloth picture that the order after arriving first will join in the image cache pond according to the joining day.
And, upload thread can whenever upload a width of cloth picture in network album after, the picture that is about to upload is deleted from the image cache pond, to save the memory space in the image cache pond.
As seen, in embodiment illustrated in fig. 1, when needs carry out the batch picture uploading, client can start M compression thread and the individual thread of uploading of N simultaneously, compression thread and upload thread and carry out parallel processing, namely compressing thread treats each width of cloth picture of uploading and compresses respectively processing, and the picture after will processing joins in the image cache pond, simultaneously, uploading each width of cloth picture that thread will join in the image cache pond uploads to respectively in the network album, that is to say, when picture is compressed processing, namely uploading the picture of having handled well, when uploading the picture of having handled well, again untreated picture is compressed processing, thereby shortening widely the uplink time of picture.
In theory, the value of M and N is larger, more can shorten the uplink time of picture, and still, the value of M and N is larger, and the load of client is also just larger, therefore, need to determine according to actual conditions the value of M and N.
Usually, in actual applications, the value of M and N is 1 and gets final product, and Fig. 3 is when the value of M and N is 1, incites somebody to action the batch picture uploading to the process schematic diagram of network album according to mode of the present invention.As shown in Figure 3, thread a (compression thread) is respectively to picture A, picture B and picture C etc. compress processing, and the picture after will processing joins in the image cache pond, simultaneously, picture A after thread b (uploading thread) will process respectively, picture B, picture C etc. uploads in the network album by network, and, in order to save the memory space in the image cache pond, thread b is after uploading to picture A in the network album, picture A can be deleted from the image cache pond, equally, after uploading to picture B in the network album, can be with picture B from the deletion of image cache pond, after uploading to picture C in the network album, picture C can be deleted from the image cache pond, the like.
If the value of one or two among M and the N is not 1, value such as M is 2, the value of N is 1, and supposes that 2 compression threads are respectively thread a and thread b, so, can be when by thread a picture A being compressed processing, by thread b picture B is compressed processing, afterwards, by thread a picture C is compressed processing, simultaneously by thread b picture D is compressed processing, the like.
So far, namely finished introduction about the inventive method embodiment.
Based on above-mentioned introduction, Fig. 4 is the composition structural representation of client implementation example of the present invention.As shown in Figure 4, comprising:
Receiver module is used for after receiving in batches picture uploading instruction, and notification handler module is carried out self function;
Processing module is used for after receiving the notice of receiver module, starts simultaneously that M compression thread and N are individual to upload thread, and M and N are positive integer; Wherein, the compression thread is used for each width of cloth picture to be uploaded is compressed respectively processing, and the picture after will processing joins in the image cache pond, uploads thread and uploads in the network album respectively for each width of cloth picture that will join the image cache pond.
The specific works flow process of client shown in Figure 4 is as follows:
After receiver module received user's batch picture uploading instruction, the notice Executive Module was carried out self function; After Executive Module receives the notice of receiver module, start simultaneously the individual thread of uploading of M compression thread and N; For each width of cloth picture to be uploaded, under the prerequisite that keeps certain definition, M compression thread compresses processing to it respectively according to predefined procedure, compress mode can be: the mode that lossy compression method mode, Lossless Compression mode, lossy compression method and Lossless Compression combine, and the picture after every width of cloth processed joins in the image cache pond; Meanwhile, upload thread and upload to respectively in the network album according to the joining day by each width of cloth picture that the order after arriving first will join in the image cache pond for N, and, upload thread can whenever upload a width of cloth picture in network album after, the picture of soon uploading is deleted from the image cache pond, to save the memory space in the image cache pond.
The concrete value of M and N all can be decided according to the actual requirements, and usually, the value of M and N is 1.
Client shown in Figure 4 can refer to PC or portable terminal etc.
As seen, in embodiment illustrated in fig. 4, when needs carry out the batch picture uploading, client can start M compression thread and the individual thread of uploading of N simultaneously, compression thread and upload thread and carry out parallel processing, namely compressing thread treats each width of cloth picture of uploading and compresses respectively processing, and the picture after will processing joins in the image cache pond, simultaneously, uploading each width of cloth picture that thread will join in the image cache pond uploads to respectively in the network album, that is to say, when picture is compressed processing, namely uploading the picture of having handled well, when uploading the picture of having handled well, again untreated picture is compressed processing, thereby shortening widely the uplink time of picture.
And scheme of the present invention has the widely scope of application, such as, for the network album in the communal space in the social networks, when needs when wherein uploading in batches picture, can adopt scheme of the present invention.
In addition, for the user, adopt scheme of the present invention after, only need choose each width of cloth picture to be uploaded and send in batches that the picture uploading instruction get final product, subsequent treatment all can be finished automatically by client and server, makes things convenient for quick again.
Therefore, scheme of the present invention is fit to popularize and promote very much, has broad application prospects.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of making, is equal to replacement, improvement etc., all should be included within the scope of protection of the invention.