CN113326459A - Picture updating method and device - Google Patents
Picture updating method and device Download PDFInfo
- Publication number
- CN113326459A CN113326459A CN202110651654.0A CN202110651654A CN113326459A CN 113326459 A CN113326459 A CN 113326459A CN 202110651654 A CN202110651654 A CN 202110651654A CN 113326459 A CN113326459 A CN 113326459A
- Authority
- CN
- China
- Prior art keywords
- picture
- identification code
- sandbox
- list
- directory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The application discloses a picture updating method and a device, and the specific implementation scheme is as follows: in response to receiving an application loading instruction, generating a first picture list corresponding to each picture identification code in the sandbox directory; when the picture loading condition is met, downloading the picture corresponding to the picture link into the sandbox and storing the picture identification code corresponding to the picture link into the sandbox directory; when the picture resource of the sandbox is larger than a first preset value, traversing the sandbox directory to generate a second picture list corresponding to each picture identification code and each picture time; traversing the second picture list; when the current picture identification code in the second picture list does not exist in the first picture list, compressing the target picture corresponding to the current picture identification code to generate a compressed picture; and updating the picture in the sandbox based on the compressed picture, and updating the first picture list based on the picture identification code corresponding to the compressed picture and the current moment. The scheme realizes a picture updating method based on the sandbox.
Description
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to the technical field of information processing, and particularly relates to a picture updating method and device.
Background
With the development of internet technology, mobile terminal use is becoming mainstream, and application programs are indispensable functions in mobile terminals. The application programs in the mobile terminal are developed from original simple characters and pictures to the existing mobile terminal with colorful pictures, motion pictures, videos and the like, wherein the pictures are the most frequently used functions in the application. There are currently several ways to load pictures in an application: firstly, link loading is directly used when an application is opened every time, and caching processing is not carried out; and secondly, the application is opened for the first time to load by using the picture link, the picture is stored in the sandbox after the picture is successfully loaded, and the same picture can be directly obtained from the sandbox when the application is opened again.
Disclosure of Invention
The application provides a picture updating method, a picture updating device, picture updating equipment and a storage medium.
According to a first aspect of the present application, there is provided a picture updating method, including: in response to receiving an application loading instruction, generating a first picture list corresponding to each picture identification code in a sandbox directory based on the sandbox directory corresponding to the application, wherein the first picture list comprises: the picture identification code and the picture time corresponding to the picture identification code; in response to the picture loading condition being met, downloading the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and storing the generated picture identification code corresponding to the picture link into the sandbox directory; traversing the sandbox directory in response to the picture resource of the sandbox being larger than a first preset value, and generating each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code and a second picture list corresponding to each picture identification code and each picture time; traversing the second picture list, and judging whether the picture identification code in the second picture list exists in the first picture list; in response to that the current picture identification code in the second picture list does not exist in the first picture list, compressing the target picture corresponding to the current picture identification code to generate a compressed picture corresponding to the target picture; and updating the picture in the sandbox based on the compressed picture, and updating the first picture list based on the picture identification code corresponding to the compressed picture and the current moment.
In some embodiments, compressing the target picture corresponding to the current picture identification code to generate a compressed picture corresponding to the target picture includes: and compressing the target picture corresponding to the current picture identification code by using a third party library in Python to generate a compressed picture corresponding to the target picture.
In some embodiments, in response to that a picture loading condition is met, downloading a picture corresponding to the obtained picture link to a sandbox corresponding to a sandbox directory and storing the generated picture identification code corresponding to the picture link to the sandbox directory includes: acquiring a picture link in response to meeting the picture loading condition; generating a picture identification code corresponding to the picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link; based on the picture identification code, searching whether a picture corresponding to the picture identification code exists in the cache and the sandbox directory or not; and in response to the cache and the picture corresponding to the picture identification code not existing in the sandbox directory, downloading the picture corresponding to the picture link into the sandbox corresponding to the sandbox directory and storing the picture identification code into the sandbox directory.
In some embodiments, traversing the sandbox directory to generate respective picture identification codes corresponding to the sandbox directory, a picture time corresponding to each picture identification code, and a second picture list corresponding to the respective picture identification codes and the respective picture times comprises: traversing the sandbox directory, generating each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code, and a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code; and sequencing each picture time in the Map set, and generating a second picture list corresponding to each sequenced picture time and each corresponding picture identification code.
In some embodiments, the method further comprises: and updating the first picture list based on the picture time corresponding to the current picture identification code in response to the current picture identification code in the second picture list existing in the first picture list.
In some embodiments, the method further comprises: and in response to the fact that the picture resources of the sandbox are not larger than a second preset value, updating the cache file corresponding to the sandbox directory based on all the obtained picture identification codes in the current sandbox directory, wherein the second preset value is smaller than the first preset value.
In some embodiments, the method further comprises: and in response to the fact that the picture resources of the sandbox are larger than a second preset value, deleting pictures corresponding to the picture identification codes in the second picture list in the sandbox by using a deleting rule.
According to a second aspect of the present application, there is provided a picture updating apparatus, the apparatus comprising: a first generating unit configured to generate, in response to receiving an application loading instruction, a first picture list corresponding to each picture identification code in a sandbox directory based on the sandbox directory corresponding to the application, wherein the first picture list includes: the picture identification code and the picture time corresponding to the picture identification code; the picture downloading unit is configured to respond to the meeting of the picture loading condition, download the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and store the generated picture identification code corresponding to the picture link into the sandbox directory; a second generating unit configured to traverse the sandbox directory to generate respective picture identification codes corresponding to the sandbox directory, picture times corresponding to each picture identification code, and a second picture list corresponding to the respective picture identification codes and the respective picture times in response to the picture resources of the sandbox being greater than the first preset value; the traversal list unit is configured to traverse the second picture list and judge whether the picture identification codes in the second picture list exist in the first picture list or not; the picture compression unit is configured to compress a target picture corresponding to the current picture identification code in response to the fact that the current picture identification code in the second picture list does not exist in the first picture list, and generate a compressed picture corresponding to the target picture; and the picture updating unit is configured to update the pictures in the sandbox based on the compressed pictures and update the first picture list based on the picture identification codes corresponding to the compressed pictures and the current moment.
In some embodiments, the picture compression unit is further configured to compress the target picture corresponding to the current picture identification code by using a third party library in Python, and generate a compressed picture corresponding to the target picture.
In some embodiments, a picture download unit, comprising: an obtaining module configured to obtain the picture link in response to satisfying the picture loading condition; a generation module configured to generate a picture identification code corresponding to the picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link; the searching module is configured to search whether a picture corresponding to the picture identification code exists in the cache and the sandbox directory or not based on the picture identification code; and the downloading module is configured to respond to the cache and the image corresponding to the image identification code not existing in the sandbox directory, download the image corresponding to the image link into the sandbox corresponding to the sandbox directory and store the image identification code into the sandbox directory.
In some embodiments, the second generating unit comprises: the generating module is configured to traverse the sandbox directory, generate each picture identification code corresponding to the sandbox directory and picture time corresponding to each picture identification code, and generate a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code; and the sequencing module is configured to sequence each picture time in the Map set and generate a second picture list corresponding to each sequenced picture time and each corresponding picture identification code.
In some embodiments, the picture updating unit is further configured to update the first picture list based on a picture time corresponding to the current picture identification code in response to the current picture identification code in the second picture list being present in the first picture list.
In some embodiments, the apparatus further comprises: and the cache updating unit is configured to update the cache file corresponding to the sandbox directory based on all the acquired picture identification codes in the current sandbox directory in response to that the picture resources of the sandbox are not greater than a second preset value, wherein the second preset value is smaller than the first preset value.
In some embodiments, the apparatus further comprises: and the picture deleting unit is configured to delete the pictures in the sandbox corresponding to the picture identification codes in the second picture list by using the deleting rule in response to the picture resource of the sandbox being larger than the second preset value.
According to a third aspect of the present application, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described in any one of the implementations of the first aspect.
According to a fourth aspect of the present application, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions, wherein the computer instructions are for causing a computer to perform the method as described in any one of the implementations of the first aspect.
According to the technology of the application, a first picture list corresponding to each picture identification code in a sandbox directory is generated based on the sandbox directory corresponding to the application in response to receiving an application loading instruction, pictures corresponding to the acquired picture links are downloaded to the sandbox corresponding to the sandbox directory and the generated picture identification codes corresponding to the picture links are stored in the sandbox directory in response to meeting a picture loading condition, the sandbox directory is traversed in response to picture resources of the sandbox being larger than a first preset value, each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture and a second picture list corresponding to each picture identification code and each picture time are generated, the second picture list is traversed, whether the picture identification code in the second picture list exists in the first picture list or not is judged, and in response to the fact that the current picture identification code in the second picture list does not exist in the first picture list, compress the target picture that current picture identification code corresponds, generate the compressed picture that the target picture corresponds, based on the compressed picture, the picture in the sandbox is updated, and based on picture identification code and the current moment that the compressed picture corresponds, update first picture list, it directly uses the link loading to open the application at every turn among the prior art to have solved, consume user flow, increase resources such as cell-phone power consumption, and the load time is long, user experience is poor, and through keeping the original picture to the sandbox, cause the App volume grow, occupy the problem in user's cell-phone space. Through compressing the picture, reduce the space that the picture took in the sandbox space, promoted user experience.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application.
Fig. 1 is a schematic diagram of a first embodiment of a picture update method according to the present application;
fig. 2 is a scene diagram of a picture updating method that can implement an embodiment of the present application;
FIG. 3 is a diagram illustrating a second embodiment of a picture update method according to the present application;
FIG. 4 is a schematic diagram illustrating an embodiment of a picture update apparatus according to the present application;
fig. 5 is a block diagram of an electronic device for implementing a picture updating method according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows a schematic diagram 100 of a first embodiment of a picture update method according to the present application. The picture updating method comprises the following steps:
In this embodiment, when an execution subject (e.g., a terminal) receives a load instruction of an application, a first picture list corresponding to each picture identification code in a current sandbox directory may be generated based on the current sandbox directory corresponding to the application. Wherein the first picture list includes: the picture identification code and the picture time corresponding to the picture identification code. The load instruction may be triggered when the application is launched. A sandbox refers to a storage space for storing individual pictures in an application. Each application in the IOS corresponds to a sandbox directory, the sandbox directory is a unique identification code file used for storing each corresponding picture in the sandbox, the unique picture identification code can be obtained by reading the file in the sandbox directory, and therefore a first picture list corresponding to each picture identification code is generated. And if the current sandbox directory does not store the unique identification code file of the picture, generating an empty first picture list.
And 102, in response to the picture loading condition being met, downloading the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and storing the generated picture identification code corresponding to the picture link into the sandbox directory.
In this embodiment, when the execution main body meets the picture loading condition, the picture corresponding to the obtained picture link is downloaded to the sandbox corresponding to the sandbox directory, and the generated picture identification code corresponding to the picture link is stored in the sandbox directory, so that the picture loading is completed. The picture link may be obtained through an interface. The picture identification code may be generated by encoding a picture link.
In some optional implementation manners of this embodiment, in response to that a picture loading condition is satisfied, downloading a picture corresponding to an acquired picture link to a sandbox corresponding to a sandbox directory and storing a generated picture identification code corresponding to the picture link to the sandbox directory includes: acquiring a picture link in response to meeting the picture loading condition; generating a picture identification code corresponding to the picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link; based on the picture identification code, searching whether a picture corresponding to the picture identification code exists in the cache and the sandbox directory or not; and in response to the cache and the picture corresponding to the picture identification code not existing in the sandbox directory, downloading the picture corresponding to the picture link into the sandbox corresponding to the sandbox directory and storing the picture identification code into the sandbox directory. By only downloading the pictures which are not in the cache and the sandbox directory, the occupancy rate of the sandbox storage space is reduced, and the processing process is more accurate and safer.
And 103, traversing the sandbox directory in response to the fact that the picture resource of the sandbox is larger than the first preset value, and generating each picture identification code corresponding to the sandbox directory, the picture time corresponding to each picture identification code and a second picture list corresponding to each picture identification code and each picture time.
In this embodiment, the execution main body may use Python to obtain the picture resource of the current sandbox, and after the execution main body determines that the picture resource of the sandbox is greater than the first preset value, traverse the sandbox directory, obtain each picture identification code corresponding to the sandbox directory and the picture time corresponding to each picture identification code, and generate a second picture list corresponding to each picture identification code and each picture time. The picture resources of the sandbox are used for representing the total amount of picture storage in the sandbox or representing the total resource amount occupied by the stored pictures. The first preset value can represent an upper threshold of a preset picture resource of the sandbox.
In some optional implementation manners of this embodiment, traversing the sandbox directory to generate each picture identification code corresponding to the sandbox directory, a picture time corresponding to each picture identification code, and a second picture list corresponding to each picture identification code and each picture time, includes: traversing the sandbox directory, generating each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code, and a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code; and sequencing each picture time in the Map set, and generating a second picture list corresponding to each sequenced picture time and each corresponding picture identification code. By sequencing the information in the second picture list according to the picture time, the subsequent search for the list is faster and more convenient.
And 104, traversing the second picture list, and judging whether the picture identification codes in the second picture list exist in the first picture list.
In this embodiment, the executing subject may traverse the second picture list and determine whether each picture identification code in the second picture list exists in the first picture list generated in step 101.
And 105, in response to that the current picture identification code in the second picture list does not exist in the first picture list, compressing the target picture corresponding to the current picture identification code to generate a compressed picture corresponding to the target picture.
In this embodiment, the execution subject may compress, in response to that the current picture identification code in the second picture list does not exist in the first picture list, the target picture corresponding to the current picture identification code in the sandbox by using a conventional library in the IOS, and generate a compressed picture corresponding to the target picture.
In some optional implementations of this embodiment, the method further includes: and in response to the fact that the current picture identification code in the second picture list exists in the first picture list, updating the first picture list based on the picture time corresponding to the current picture identification code, and ensuring that the information of the first picture list is the most accurate picture loading information.
And 106, updating the picture in the sandbox based on the compressed picture, and updating the first picture list based on the picture identification code corresponding to the compressed picture and the current moment.
In this embodiment, the execution subject may replace the corresponding picture in the sandbox based on the compressed picture generated in step 105, so as to reduce the picture resource of the sandbox, and add the picture identification code and the current time to the first picture list based on the picture identification code and the current time corresponding to the compressed picture, so as to expand the first picture list.
In some optional implementations of this embodiment, the method further includes: and in response to the fact that the picture resources of the sandbox are not larger than a second preset value, updating the cache file corresponding to the sandbox directory based on all the obtained picture identification codes in the current sandbox directory, wherein the second preset value is smaller than the first preset value. For example, the second preset value is half of the first preset value. When the image resources of the sandbox are compressed to a certain condition, the cache is updated, so that when problems are loaded by the sandbox, the images can be loaded from the cache, and user experience is further improved.
In some optional implementations of this embodiment, the method further includes: and in response to the fact that the picture resources of the sandbox are larger than a second preset value, deleting pictures corresponding to the picture identification codes in the second picture list in the sandbox by using a deleting rule. And when the sandbox picture compression does not meet the preset compression condition, deleting part of the pictures so as to improve the loading speed of the pictures.
It should be noted that, since the picture compression is a well-known technology which is widely researched and applied at present, it is not described herein again.
With continued reference to fig. 2, the picture updating method 200 of the present embodiment is executed in the mobile phone terminal 201. When the mobile phone terminal 201 receives an application loading instruction, a first picture list 202 corresponding to each picture identification code in the sandbox directory is generated based on the sandbox directory corresponding to the application, when the mobile phone terminal 201 meets a picture loading condition, pictures corresponding to the obtained picture links are downloaded to the sandbox corresponding to the sandbox directory and the generated picture identification codes corresponding to the picture links are stored in the sandbox directory 203, when the mobile phone terminal 201 judges that the picture resources of the sandbox are greater than a first preset value, the sandbox directory is traversed to generate each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code and a second picture list 204 corresponding to each picture identification code and each picture time, then the mobile phone terminal 201 traverses the second picture list to judge whether the picture identification codes in the second picture list exist in the first picture list 205, when the mobile phone terminal 201 determines that the current picture identification code in the second picture list does not exist in the first picture list, the target picture corresponding to the current picture identification code is compressed to generate a compressed picture 206 corresponding to the target picture, and finally, the mobile phone terminal 201 updates the picture in the sandbox based on the compressed picture and updates 207 the first picture list based on the picture identification code corresponding to the compressed picture and the current moment.
The image updating method provided by the above embodiment of the present application adopts the steps of generating a first image list corresponding to each image identification code in a sandbox directory based on the sandbox directory corresponding to the application in response to receiving an application loading instruction, downloading the image corresponding to the acquired image link to the sandbox corresponding to the sandbox directory and storing the generated image identification code corresponding to the image link to the sandbox directory in response to satisfying an image loading condition, traversing the sandbox directory in response to the image resource of the sandbox being greater than a first preset value, generating each image identification code corresponding to the sandbox directory, the image time corresponding to each image identification code and a second image list corresponding to each image and each image time, traversing the second image list, determining whether the image identification code in the second image list exists in the first image list, and in response to the current image identification code in the second image list not existing in the first image list, compress the target picture that current picture identification code corresponds, generate the compressed picture that the target picture corresponds, based on the compressed picture, the picture in the sandbox is updated, and based on picture identification code and the current moment that the compressed picture corresponds, update first picture list, it directly uses the link loading to open the application at every turn among the prior art to have solved, consume user flow, increase resources such as cell-phone power consumption, and the load time is long, user experience is poor, and through keeping the original picture to the sandbox, cause the App volume grow, occupy the problem in user's cell-phone space. Through compressing the picture, reduce the space that the picture took in the sandbox space, promoted user experience.
With further reference to fig. 3, a schematic diagram 300 of a second embodiment of a picture update method is shown. The process of the method comprises the following steps:
In this embodiment, when the execution subject determines that the current picture identification code in the second picture list does not exist in the first picture list, the target picture corresponding to the current picture identification code is compressed by using a pink library in Python, and a compressed picture corresponding to the target picture is generated.
And step 306, updating the picture in the sandbox based on the compressed picture, and updating the first picture list based on the picture identification code corresponding to the compressed picture and the current moment.
In the present embodiment, the specific operations of steps 301 to 304 and 306 are substantially the same as the operations of steps 101 to 104 and 106 in the embodiment shown in fig. 1, and are not repeated herein.
As can be seen from fig. 3, compared with the embodiment corresponding to fig. 1, the schematic diagram 300 of the picture updating method in this embodiment adopts a method that, in response to that the current picture identification code in the second picture list does not exist in the first picture list, a third party library in Python is used to compress the target picture corresponding to the current picture identification code, so as to generate a compressed picture corresponding to the target picture. The lossless compression of the picture is realized, the space occupied by the picture in the sandbox space is reduced by performing lossless compression on the picture, and the user experience is improved.
With further reference to fig. 4, as an implementation of the methods shown in fig. 1 to 3, the present application provides an embodiment of an image updating apparatus, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 4, the picture update apparatus 400 of the present embodiment includes: the image processing device comprises a first generating unit 401, an image downloading unit 402, a second generating unit 403, a traversal list unit 404, an image compressing unit 405 and an image updating unit 406, wherein the first generating unit is configured to generate a first image list corresponding to each image identification code in a sandbox directory based on the sandbox directory corresponding to the application in response to receiving an application loading instruction, and the first image list comprises: the picture identification code and the picture time corresponding to the picture identification code; the picture downloading unit is configured to respond to the meeting of the picture loading condition, download the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and store the generated picture identification code corresponding to the picture link into the sandbox directory; a second generating unit configured to traverse the sandbox directory to generate respective picture identification codes corresponding to the sandbox directory, picture times corresponding to each picture identification code, and a second picture list corresponding to the respective picture identification codes and the respective picture times in response to the picture resources of the sandbox being greater than the first preset value; the traversal list unit is configured to traverse the second picture list and judge whether the picture identification codes in the second picture list exist in the first picture list or not; the picture compression unit is configured to compress a target picture corresponding to the current picture identification code in response to the fact that the current picture identification code in the second picture list does not exist in the first picture list, and generate a compressed picture corresponding to the target picture; and the picture updating unit is configured to update the pictures in the sandbox based on the compressed pictures and update the first picture list based on the picture identification codes corresponding to the compressed pictures and the current moment.
In this embodiment, specific processes of the first generating unit 401, the picture downloading unit 402, the second generating unit 403, the traverse list unit 404, the picture compressing unit 405, and the picture updating unit 406 of the picture updating apparatus 400 and technical effects thereof may respectively refer to the related descriptions of step 101 to step 106 in the embodiment corresponding to fig. 1, and are not repeated herein.
In some optional implementation manners of this embodiment, the picture compression unit is further configured to compress the target picture corresponding to the current picture identification code by using a third party library in Python, so as to generate a compressed picture corresponding to the target picture.
In some optional implementations of this embodiment, the picture downloading unit includes: an obtaining module configured to obtain the picture link in response to satisfying the picture loading condition; a generation module configured to generate a picture identification code corresponding to the picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link; the searching module is configured to search whether a picture corresponding to the picture identification code exists in the cache and the sandbox directory or not based on the picture identification code; and the downloading module is configured to respond to the cache and the image corresponding to the image identification code not existing in the sandbox directory, download the image corresponding to the image link into the sandbox corresponding to the sandbox directory and store the image identification code into the sandbox directory.
In some optional implementation manners of this embodiment, the second generating unit includes: the generating module is configured to traverse the sandbox directory, generate each picture identification code corresponding to the sandbox directory and picture time corresponding to each picture identification code, and generate a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code; and the sequencing module is configured to sequence each picture time in the Map set and generate a second picture list corresponding to each sequenced picture time and each corresponding picture identification code.
In some optional implementations of the embodiment, the picture updating unit is further configured to update the first picture list based on a picture time corresponding to the current picture identification code in response to the current picture identification code in the second picture list being present in the first picture list.
In some optional implementations of this embodiment, the apparatus further includes: and the cache updating unit is configured to update the cache file corresponding to the sandbox directory based on all the acquired picture identification codes in the current sandbox directory in response to that the picture resources of the sandbox are not greater than a second preset value, wherein the second preset value is smaller than the first preset value.
In some optional implementations of this embodiment, the apparatus further includes: and the picture deleting unit is configured to delete the pictures in the sandbox corresponding to the picture identification codes in the second picture list by using the deleting rule in response to the picture resource of the sandbox being larger than the second preset value.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 5, the electronic device is a block diagram of an electronic device according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 5, the electronic apparatus includes: one or more processors 501, memory 502, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 5, one processor 501 is taken as an example.
The memory 502, which is a non-transitory computer-readable storage medium, may be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules corresponding to the picture updating method in the embodiment of the present application (for example, the first generation unit 401, the picture download unit 402, the second generation unit 403, the traverse list unit 404, the picture compression unit 405, and the picture updating unit 406 shown in fig. 4). The processor 501 executes various functional applications of the server and picture update by running non-transitory software programs, instructions and modules stored in the memory 502, namely, implements the picture update method in the above method embodiment.
The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from use of the picture update electronic device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 502 may optionally include memory located remotely from the processor 501, which may be connected to the picture update electronics via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the picture updating method may further include: an input device 503 and an output device 504. The processor 501, the memory 502, the input device 503 and the output device 504 may be connected by a bus or other means, and fig. 5 illustrates the connection by a bus as an example.
The input device 503 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the picture update electronic apparatus, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input devices. The output devices 504 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, a first picture list corresponding to each picture identification code in a sandbox directory is generated based on the sandbox directory corresponding to the application in response to receiving an application loading instruction, the obtained pictures corresponding to the picture links are downloaded to the sandbox corresponding to the sandbox directory and the generated picture identification codes corresponding to the picture links are stored in the sandbox directory in response to meeting a picture loading condition, the sandbox directory is traversed in response to the picture resource of the sandbox being larger than a first preset value, a second picture list corresponding to each picture identification code corresponding to the sandbox directory, the picture time corresponding to each picture identification code and the picture time is generated, the second picture list judges whether the picture identification code in the second picture list exists in the first picture list or not, and in response to the current picture identification code in the second picture list not existing in the first picture list, compress the target picture that current picture identification code corresponds, generate the compressed picture that the target picture corresponds, based on the compressed picture, the picture in the sandbox is updated, and based on picture identification code and the current moment that the compressed picture corresponds, update first picture list, it directly uses the link loading to open the application at every turn among the prior art to have solved, consume user flow, increase resources such as cell-phone power consumption, and the load time is long, user experience is poor, and through keeping the original picture to the sandbox, cause the App volume grow, occupy the problem in user's cell-phone space. Through carrying out lossless compression with the picture, reduce the space that the picture took in the sandbox space, promoted user experience.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (16)
1. A picture update method, the method comprising:
in response to receiving an application loading instruction, generating a first picture list corresponding to each picture identification code in a sandbox directory based on the sandbox directory corresponding to the application, wherein the first picture list comprises: the picture identification code and the picture time corresponding to the picture identification code;
in response to the picture loading condition being met, downloading the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and storing the generated picture identification code corresponding to the picture link into the sandbox directory;
traversing the sandbox directory to generate each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code and a second picture list corresponding to each picture identification code and each picture time in response to the picture resource of the sandbox being larger than a first preset value;
traversing the second picture list, and judging whether the picture identification code in the second picture list exists in the first picture list;
in response to that the current picture identification code in the second picture list does not exist in the first picture list, compressing a target picture corresponding to the current picture identification code to generate a compressed picture corresponding to the target picture;
and updating the picture in the sandbox based on the compressed picture, and updating the first picture list based on the picture identification code corresponding to the compressed picture and the current moment.
2. The method of claim 1, wherein compressing the target picture corresponding to the current picture identification code to generate the compressed picture corresponding to the target picture comprises:
and compressing the target picture corresponding to the current picture identification code by using a third party library in Python to generate a compressed picture corresponding to the target picture.
3. The method according to claim 1, wherein the downloading the picture corresponding to the acquired picture link to the sandbox corresponding to the sandbox directory and storing the generated picture identification code corresponding to the picture link to the sandbox directory in response to the picture loading condition being met comprises:
acquiring a picture link in response to meeting the picture loading condition;
generating a picture identification code corresponding to the picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link;
based on the picture identification code, searching whether a picture corresponding to the picture identification code exists in a cache and the sandbox directory or not;
and in response to the cache and the absence of the picture corresponding to the picture identification code in the sandbox directory, downloading the picture corresponding to the picture link into the sandbox corresponding to the sandbox directory and storing the picture identification code into the sandbox directory.
4. The method of claim 1, wherein traversing the sandbox directory to generate respective picture identification codes corresponding to the sandbox directory, picture times corresponding to each picture identification code, and a second picture list corresponding to the respective picture identification codes and the respective picture times comprises:
traversing the sandbox directory to generate each picture identification code corresponding to the sandbox directory, picture time corresponding to each picture identification code, and a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code;
and sequencing each picture time in the Map set, and generating a second picture list corresponding to each sequenced picture time and each corresponding picture identification code.
5. The method of claim 1, further comprising:
and updating the first picture list based on the picture time corresponding to the current picture identification code in response to the current picture identification code in the second picture list existing in the first picture list.
6. The method of claim 1, further comprising:
and in response to the fact that the picture resources of the sandbox are not larger than a second preset value, updating the cache file corresponding to the sandbox directory based on all the obtained picture identification codes in the current sandbox directory, wherein the second preset value is smaller than the first preset value.
7. The method of claim 1, further comprising:
and in response to that the picture resources of the sandbox are larger than a second preset value, deleting pictures corresponding to the picture identification codes in the second picture list in the sandbox by using a deleting rule.
8. A picture update apparatus, the apparatus comprising:
a first generating unit configured to generate, in response to receiving an application loading instruction, a first picture list corresponding to each picture identification code in a sandbox directory corresponding to the application, wherein the first picture list includes: the picture identification code and the picture time corresponding to the picture identification code;
the picture downloading unit is configured to respond to the condition that the picture loading condition is met, download the picture corresponding to the obtained picture link into the sandbox corresponding to the sandbox directory and store the generated picture identification code corresponding to the picture link into the sandbox directory;
a second generating unit configured to traverse the sandbox directory to generate respective picture identification codes corresponding to the sandbox directory, picture times corresponding to each picture identification code, and a second picture list corresponding to the respective picture identification codes and the respective picture times in response to the picture resources of the sandbox being greater than a first preset value;
a traversal list unit configured to traverse the second picture list and determine whether a picture identification code in the second picture list exists in the first picture list;
the picture compression unit is configured to compress a target picture corresponding to a current picture identification code in response to the fact that the current picture identification code in the second picture list does not exist in the first picture list, and generate a compressed picture corresponding to the target picture;
and the picture updating unit is configured to update the pictures in the sandbox based on the compressed pictures and update the first picture list based on the picture identification codes corresponding to the compressed pictures and the current moment.
9. The apparatus according to claim 8, wherein the picture compression unit is further configured to compress the target picture corresponding to the current picture identification code by using a third party library in Python, and generate a compressed picture corresponding to the target picture.
10. The apparatus of claim 8, wherein the picture downloading unit comprises:
an obtaining module configured to obtain the picture link in response to satisfying the picture loading condition;
a generating module configured to generate a picture identification code corresponding to a picture link based on the picture link, wherein the picture identification code is generated by encrypting the picture link;
the searching module is configured to search whether a picture corresponding to the picture identification code exists in a cache and the sandbox directory or not based on the picture identification code;
the downloading module is configured to respond to the cache and the absence of the picture corresponding to the picture identification code in the sandbox directory, download the picture corresponding to the picture link into the sandbox corresponding to the sandbox directory and store the picture identification code into the sandbox directory.
11. The apparatus of claim 8, wherein the second generating unit comprises:
the generating module is configured to traverse the sandbox directory, generate each picture identification code corresponding to the sandbox directory and picture time corresponding to each picture identification code, and generate a Map set corresponding to each picture identification code and each picture time, wherein the Map set is used for representing a mapping relation between the picture time and the picture identification code;
and the sequencing module is configured to sequence each picture time in the Map set and generate a second picture list corresponding to each sequenced picture time and each corresponding picture identification code.
12. The apparatus of claim 8, wherein the picture update unit is further configured to update the first picture list based on a picture time corresponding to a current picture identification code in response to the current picture identification code in the second picture list being present in the first picture list.
13. The apparatus of claim 8, further comprising:
and the cache updating unit is configured to update the cache file corresponding to the sandbox directory based on all the acquired picture identification codes in the current sandbox directory in response to that the picture resources of the sandbox are not greater than a second preset value, wherein the second preset value is smaller than the first preset value.
14. The apparatus of claim 8, further comprising:
and the picture deleting unit is configured to delete the pictures in the sandbox corresponding to the picture identification codes in the second picture list by using a deleting rule in response to the picture resource of the sandbox being greater than a second preset value.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
16. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110651654.0A CN113326459B (en) | 2021-06-11 | 2021-06-11 | Picture updating method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110651654.0A CN113326459B (en) | 2021-06-11 | 2021-06-11 | Picture updating method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113326459A true CN113326459A (en) | 2021-08-31 |
| CN113326459B CN113326459B (en) | 2024-04-05 |
Family
ID=77421210
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110651654.0A Active CN113326459B (en) | 2021-06-11 | 2021-06-11 | Picture updating method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113326459B (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8176321B1 (en) * | 2010-05-18 | 2012-05-08 | Google Inc. | Safe installation of browser extensions |
| CN108304207A (en) * | 2018-03-01 | 2018-07-20 | 上海找钢网信息科技股份有限公司 | Mix the resource regeneration method and system of APP application programs |
| CN110555118A (en) * | 2018-03-28 | 2019-12-10 | 武汉斗鱼网络科技有限公司 | Method and device for loading picture |
-
2021
- 2021-06-11 CN CN202110651654.0A patent/CN113326459B/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8176321B1 (en) * | 2010-05-18 | 2012-05-08 | Google Inc. | Safe installation of browser extensions |
| CN108304207A (en) * | 2018-03-01 | 2018-07-20 | 上海找钢网信息科技股份有限公司 | Mix the resource regeneration method and system of APP application programs |
| CN110555118A (en) * | 2018-03-28 | 2019-12-10 | 武汉斗鱼网络科技有限公司 | Method and device for loading picture |
Non-Patent Citations (1)
| Title |
|---|
| 赵洋;胡龙;熊虎;秦志光;: "基于沙盒的Android恶意软件动态分析方案", 信息网络安全, no. 12, 10 December 2014 (2014-12-10) * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113326459B (en) | 2024-04-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR102484617B1 (en) | Method and apparatus for generating model for representing heterogeneous graph node, electronic device, storage medium and program | |
| CN112102448B (en) | Virtual object image display method, device, electronic device and storage medium | |
| CN111107392A (en) | Video processing method, apparatus and electronic device | |
| CN110505245A (en) | Application login method, device and equipment | |
| JP7402201B2 (en) | Video playback start optimization method, device, electronic device, computer readable storage medium and computer program | |
| CN113452535A (en) | Upgrading method, information processing method and device and electronic equipment | |
| CN110852379A (en) | Training sample generation method, device and electronic device | |
| CN112346512A (en) | Time synchronization method and device | |
| CN111736712B (en) | Input information prediction method, system, server and electronic equipment | |
| CN113158098B (en) | Page generation method, device, equipment and medium | |
| CN111562962B (en) | Picture rendering method and device, electronic equipment and storage medium | |
| CN111246305A (en) | Video preview method, device, equipment and storage medium | |
| CN111741053B (en) | Data pre-downloading method, device, server, terminal and storage medium | |
| CN111177558B (en) | Channel service construction method and device | |
| CN113326459B (en) | Picture updating method and device | |
| CN111177479A (en) | Method and device for obtaining feature vector of nodes in relational network graph | |
| CN111160552A (en) | Negative sampling processing method, device, equipment and computer storage medium | |
| CN113518088B (en) | Data processing method, device, server, client and medium | |
| CN112100553B (en) | Webpage configuration method and device, electronic equipment and storage medium | |
| CN111443926B (en) | Method, device, equipment and storage medium for cleaning data | |
| CN114979471A (en) | Interface display method and device, electronic equipment and computer readable storage medium | |
| CN116382787A (en) | Method and device for loading animation in page, electronic equipment and readable storage medium | |
| CN111539225B (en) | Search method and device for semantic understanding frame structure | |
| CN113961270A (en) | Data processing method and device applied to vehicle HMI and vehicle | |
| CN112507100A (en) | Method and device for updating question-answering system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |