Picture loading method and device, electronic equipment and storage medium

By receiving and cacheing the URL of preloaded images in the APP and filling them to the page when needed, the problem of excessive size of the initial installation package of the APP and difficulty in updating images is solved, improving the image loading performance and user experience.

CN120067474APending Publication Date: 2025-05-30BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510231771.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-27
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the initial installation package of the APP is too large, occupying too much storage space for user equipment, and it is difficult to update pictures, which affects the user experience.

Method used

By receiving the target application data provided by the server, the target image URL associated with the preloaded image is identified, and the preloaded image is cached in memory. Based on the image filling requirements of the application page to be displayed, the cached preloaded image is filled into the image display area, triggering the page display.

Benefits of technology

Without major changes to the application architecture, the application image loading performance is improved, development risks are reduced, labor and time cost investment is reduced, projects are ensured to be quickly iterated and adapted to image loading needs in different business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067474A_ABST
    Figure CN120067474A_ABST
Patent Text Reader

Abstract

The invention provides a picture loading method and apparatus, an electronic device and a storage medium. The method comprises the steps of receiving application data corresponding to a target application sent by a server based on a data acquisition request; in response to a target picture URL associated with the pre-loaded picture in the application data, caching the pre-loaded picture in a memory according to the target picture URL; and based on a picture filling demand of the to-be-displayed application page, filling a picture display area of the to-be-displayed application page with a pre-loaded picture which is cached in the memory and is matched with the to-be-displayed application page, so as to trigger page display. According to the method and the device, the application picture loading performance can be improved on the premise that the application architecture does not need to be greatly modified by performing preloading marking in advance, and for different picture loading scenes, smooth operation of a preloading mechanism can be ensured based on the preloading marking rule, picture loading requirements in different business scenes can be easily adapted, and the picture loading efficiency is improved. And the method has relatively high universality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, electronic device, and storage medium for image loading. Background Art

[0002] In the prior art, image resources related to an APP (Application) are usually directly built into the App, resulting in an overly large initial installation package of the App, occupying too much storage space on the user's device, and being difficult to update images subsequently. Each update may require the user to re-download the entire App, resulting in poor user experience.

[0003] To control the size of the initial installation package of the APP to a certain extent, a solution of downloading a zip image package with a matching download logic is introduced, but this approach has many drawbacks. The specially written download logic is highly complex and prone to compatibility problems. In different network environments and different device models, situations such as frequent download interruptions and decompression errors may occur, resulting in failed image acquisition and affecting the normal use of the App. Moreover, to adapt to various image acquisition scenarios, continuous optimization of the download logic is required, and the development and maintenance costs remain high, which is not conducive to the long-term promotion and iteration of the project. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide an image loading method, apparatus, electronic device, and storage medium that overcome the above problems or at least partially solve the above problems.

[0005] In a first aspect, embodiments of this application provide an image loading method, including:

[0006] Receiving application data corresponding to a target application sent by a server based on a data acquisition request;

[0007] In response to the existence of a target image URL associated with a pre-loaded image in the application data, caching the pre-loaded image in memory according to the target image URL;

[0008] Based on the image filling requirement of the application page to be displayed, filling the pre-loaded image cached in the memory and matching the application page to be displayed into the image display area of the application page to be displayed to trigger page display.

[0009] In a second aspect, embodiments of this application provide an image loading apparatus, including:

[0010] A receiving module, configured to receive application data corresponding to a target application sent by a server based on a data acquisition request;

[0011] A caching module, configured to cache a pre-loaded picture in memory according to a target picture URL in response to the existence of a target picture URL associated with the pre-loaded picture in the application data.

[0012] A processing module, configured to fill the pre-loaded picture cached in the memory and matching the to-be-displayed application page into a picture display area of the to-be-displayed application page based on the picture filling requirement of the to-be-displayed application page, so as to trigger page display.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the picture loading method described in the first aspect above are implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the picture loading method described in the first aspect above are implemented.

[0015] In the technical solution of the embodiment of the present application, after obtaining the application data corresponding to the target application provided by the server based on the data acquisition request, in response to identifying the existence of a target picture URL associated with the pre-loaded picture in the application data, the pre-loaded picture is cached in memory according to the target picture URL, and based on the picture filling requirement of the to-be-displayed application page, the pre-loaded picture cached in the memory and matching the to-be-displayed application page is filled into the specified picture display area to trigger page display. By pre-marking for pre-loading, the application picture loading performance can be improved without major changes to the application architecture, minimizing the development risk, reducing the input of human and time costs, and ensuring the rapid iteration and online launch of the project.

[0016] Moreover, for different picture loading scenarios, the smooth operation of the pre-loading mechanism can be ensured based on the pre-loading marking rules, easily adapting to the picture loading requirements in different business scenarios, and having strong versatility. Description of the Drawings

[0017] Figure 1 A schematic diagram showing the picture loading method provided by the embodiment of the present application;

[0018] Figure 2 A flowchart showing the implementation of the picture loading method provided by the embodiment of the present application;

[0019] Figure 3 A schematic diagram showing the picture loading device provided by the embodiment of the present application;

[0020] Figure 4Schematic diagram of the electronic device provided by the embodiment of the present application. Detailed implementation manners

[0021] Next, the technical solutions in the embodiments of the present application will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0022] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, the appearances of "in one embodiment" or "in an embodiment" throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Multiple in the embodiments of the present application can include two and more than two.

[0023] In various embodiments of the present application, it should be understood that the sequence numbers of the following processes do not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0024] The embodiment of the present application provides a picture loading method, as Figure 1 shown, the method includes:

[0025] Step 101, receive the application data corresponding to the target application sent by the server based on the data acquisition request.

[0026] The terminal device installed with the target application interacts with the server based on the target application. After sending a data acquisition request to the server based on the target application, it receives the application data corresponding to the target application provided by the server, and extracts the required data after parsing the received application data. The server, as the backend platform of the target application, is used to provide application data for the target application. The provided application data is structured in a standard data format, and the standard data format makes the data more efficient, accurate, and reliable during transmission and parsing.

[0027] In various scenarios such as when the target application is started, the target application performs page switching, and the target application performs content update, the terminal device can send a data acquisition request to the server based on the target application, so as to trigger page display, perform page switching, or page update based on the received application data.

[0028] Step 102: In response to the existence of a target picture URL associated with the pre-loaded picture in the application data, cache the pre-loaded picture in the memory according to the target picture URL.

[0029] After receiving the application data provided by the server, if it is recognized that the application data contains a target picture URL (Uniform Resource Locator) associated with the pre-loaded picture, the corresponding picture is searched based on the target picture URL and loaded into the memory to cache the pre-loaded picture in the memory. By loading the required picture resources into the memory, when these pictures are needed, they can be directly obtained from the memory without having to download again, thus reducing the waiting time and enhancing the user experience.

[0030] Among them, the picture URL is the unique address of the picture on the Internet, used to identify and access the picture. The picture URL points to the specific location of the picture file on the network. When the picture URL is entered or clicked in the browser, the browser will send a request according to this address to provide the picture file for the user to view or download. The target picture URL associated with the pre-loaded picture has preset marking information, and the target picture URL can be identified from multiple picture URLs based on this marking information.

[0031] Step 103: Based on the picture filling requirement of the application page to be displayed, fill the pre-loaded picture cached in the memory and matching the application page to be displayed into the picture display area of the application page to be displayed to trigger page display.

[0032] When the layout construction work of the application page to be displayed of the target application is about to be completed, that is, all text boxes, buttons, other components, etc. have been typeset according to the design, and only picture filling is left, based on the picture filling requirement of the application page to be displayed, the pre-loaded picture cached in the memory and matching the application page to be displayed is filled into the corresponding picture display area to trigger page display, so that when the user opens this page, they can see the complete and clear picture content immediately without waiting for a long time for the picture to load, greatly enhancing the visual interaction experience.

[0033] The application page to be displayed in the embodiment of the present application is an application page in the target application, such as the application home page, the application page to be switched to; the pre-loaded picture can be, for example, an advertisement display picture, a detailed introduction picture, a list thumbnail picture, etc., so that the picture pre-loading scheme can adapt to the picture loading requirements in different business scenarios and improve the overall response speed of the target application.

[0034] In the above implementation of this application, after obtaining the application data corresponding to the target application provided by the server based on the data acquisition request, in response to identifying that there is a target picture URL associated with the pre-loaded picture in the application data, the pre-loaded picture is cached in the memory according to the target picture URL. Based on the picture filling requirements of the application page to be displayed, the pre-loaded picture cached in the memory and matching the application page to be displayed is filled into the specified picture display area, triggering the page display. By pre-making pre-loading marks in advance, without making major changes to the application architecture, the application picture loading performance can be improved, the development risk can be minimized, the input of human and time costs can be reduced, and the project can be ensured to be quickly iterated and launched.

[0035] And for different picture loading scenarios, based on the pre-loading mark rules, the smooth operation of the pre-loading mechanism can be ensured, and the picture loading requirements in different business scenarios can be easily adapted, with strong versatility.

[0036] The following introduces the solution for loading pictures in the memory based on the target picture URL. When caching the pre-loaded picture in the memory according to the target picture URL in response to the existence of the target picture URL associated with the pre-loaded picture in the application data, it includes:

[0037] In response to the existence of the target picture URL in the application data, activate the pre-loading process, where the application data includes N target picture URLs, and N is an integer greater than or equal to 1;

[0038] Identify whether the pre-loaded pictures corresponding to the N target picture URLs are cached in the memory;

[0039] If the pre-loaded pictures corresponding to the N target picture URLs are not cached in the memory or only some of the pre-loaded pictures corresponding to the target picture URLs are cached, extract the picture data to be loaded from the local cache and / or network, and cache the extracted picture data to be loaded in the memory;

[0040] If the pre-loaded pictures corresponding to the N target picture URLs are cached in the memory, continue to retain the pre-loaded pictures in the memory.

[0041] When it is identified based on the application data provided by the server that a certain data item is a picture URL and this picture URL has the preset mark information for associated picture pre-loading (such as including the word "prolad"), immediately activate the picture pre-loading process. At this time, there is no need to reconstruct a complex picture loading program, and the native picture loader pre-integrated in the target application can be called. The native picture loader is a stable and highly compatible picture loading component built during the initial development of the target application. After being tested and optimized in a large number of scenarios, by calling the native picture loader, its advantages can be fully utilized for picture loading.

[0042] Among them, the application data provided by the server includes N target picture URLs. After activating the picture preloading process, it is identified whether there are preloaded pictures corresponding to the N target picture URLs cached in the memory. If there are preloaded pictures corresponding to the N target picture URLs cached in the memory, the cached preloaded pictures are continued to be retained in the memory without re-performing picture preloading. If there are no preloaded pictures corresponding to the N target picture URLs cached in the memory, or only some of the preloaded pictures corresponding to the target picture URLs are cached in the memory, then based on the target picture URLs corresponding to the uncached preloaded pictures, matching pictures to be loaded data are extracted from the local cache and / or the network, and the extracted pictures to be loaded data are cached in the memory to achieve caching of the preloaded pictures corresponding to the N target picture URLs in the memory.

[0043] For the situation where pictures to be loaded data need to be extracted, the extraction of pictures to be loaded data can be performed only in the local cache, only on the network, or separately in the local cache and on the network. When extracting matching pictures to be loaded data on the network, the data can be extracted at a CDN (Content Delivery Network) node, a web server, or the backend platform of the target application.

[0044] By identifying whether there are preloaded pictures corresponding to the N target picture URLs cached in the memory, it is possible not to re-perform picture preloading when there are preloaded pictures in the memory. If there are no preloaded pictures cached in the memory or only some preloaded pictures are cached, then the corresponding picture data is extracted through one or more channels and loaded into the memory to ensure that the preloaded pictures required in the memory are cached.

[0045] Among them, each picture cached in the memory corresponds to a unique identifier, and the unique identifier is generated based on the picture URL. When identifying whether there are preloaded pictures corresponding to the N target picture URLs cached in the memory, it includes:

[0046] Generating N target identifiers based on the N target picture URLs;

[0047] Searching in the memory to find whether there is a picture whose unique identifier matches the target identifier for identifying the preloaded picture.

[0048] For each picture cached in memory, it corresponds to a unique identifier, which is generated based on the picture URL. For example, the unique identifier is the picture URL or the MD5 value generated based on the picture URL. When identifying whether there are preloaded pictures corresponding to N target picture URLs cached in memory, N target identifiers are generated according to the N target picture URLs, and the N target identifiers correspond one-to-one with the N target picture URLs. The way of generating the target identifier based on the target picture URL is the same as the way of generating the unique identifier based on the picture URL.

[0049] After generating N target identifiers based on the N target picture URLs, compare the N target identifiers with the unique identifiers corresponding to the pictures in memory to find out whether there is a picture in memory whose unique identifier matches the target identifier, so as to identify the preloaded picture in memory. If the unique identifier of a certain picture in memory matches a target identifier, it is determined that the picture is the preloaded picture cached in memory.

[0050] As an example, there are K pictures cached in memory, and the unique identifier of the picture is the MD5 value generated based on the picture URL. After starting the preloading process based on the target picture URLs included in the application data provided by the server, generate N target identifiers respectively corresponding to the MD5 values of the N target picture URLs, and then check whether there is a unique identifier that matches the target identifier among the K unique identifiers. If there is, determine the picture corresponding to the unique identifier as the preloaded picture cached in memory. If not, determine that there is no preloaded picture corresponding to the target picture URL cached in memory.

[0051] Among them, the memory cache is used as a first-level cache, and its advantage is fast reading speed. When the target application needs to load a picture, if the required picture exists in memory, it is directly loaded and displayed from memory to maximize the loading speed and optimize the user experience. Therefore, after obtaining the target picture URL associated with the preloaded picture, first check whether there is a matching preloaded picture cached in memory. If there is a matching preloaded picture cached in memory, there is no need to reload. If there is no cache or only part of the preloaded pictures are cached in memory, it is necessary to extract the picture data to be loaded from the corresponding location and cache it in memory.

[0052] The following introduces the situation where there is no preloaded picture corresponding to the target picture URL cached in memory or only part of the preloaded pictures corresponding to the target picture URLs are cached. If there is no preloaded picture corresponding to the N target picture URLs cached in memory or only part of the preloaded pictures corresponding to the target picture URLs are cached, when extracting the picture data to be loaded from the local cache and / or the network and caching the extracted picture data to memory, it includes:

[0053] Determine M target image URLs based on the caching situation of pre-loaded images in memory. The M target image URLs correspond to M pre-loaded images to be cached, and the value of M is less than or equal to N;

[0054] Based on the M target image URLs, sequentially search for matching pre-loaded images in the local cache and on the network. The local images in the local cache correspond to an image URL;

[0055] In response to finding the M pre-loaded images corresponding to the M target image URLs, cache the M pre-loaded images to be cached into memory.

[0056] If the pre-loaded image corresponding to any of the N target image URLs is not cached in memory, and at this time the value of M is equal to N, sequentially search for matching image data in the local cache and on the network based on the N target image URLs. After finding the N pre-loaded images corresponding to the N target image URLs, cache the N pre-loaded images to be cached into memory. That is, when performing image search, first check the local cache. If it exists in the local cache, extract the image from the local cache and cache the image into memory. If it does not exist or only part of it exists in the local cache, continue to download the image from the network to cache it into memory.

[0057] If some of the pre-loaded images corresponding to the target image URLs are cached in memory, then compare the partial target image URLs corresponding to the memory with the N target image URLs, and determine M target image URLs based on the difference situation, so as to determine M target image URLs based on the caching situation of the pre-loaded images in memory and the pre-loaded images to be cached, and the value of M is less than N. Then, based on the M target image URLs, sequentially search for matching pre-loaded images in the local cache and on the network. After finding the M pre-loaded images corresponding to the M target image URLs, cache the M pre-loaded images to be cached into memory.

[0058] Among them, when sequentially searching for matching pre-loaded images in the local cache and on the network based on the M target image URLs, it includes:

[0059] Based on the M target image URLs, search for a matching first image URL among the image URLs corresponding to the local images;

[0060] Determine the local image corresponding to the found first image URL as the pre-loaded image;

[0061] In response to not finding the first image URLs corresponding to the M target image URLs respectively, continue to search for matching pre-loaded images on the network based on at least some of the M target image URLs.

[0062] The local images in the local cache correspond to an image URL. After determining M target image URLs based on the cache situation of the pre-loaded images in memory and the pre-loaded images to be cached, first, based on the M target image URLs, search for the matching first image URL among the image URLs corresponding to the local images. If a matching first image URL is found, determine the local image corresponding to the first image URL as the pre-loaded image, so as to determine the pre-loaded image in the local cache for caching to memory. If the first image URLs corresponding to the M target image URLs are not found in the local cache, it is necessary to determine at least some of the target image URLs among the M target image URLs, and based on the determined at least some target image URLs, continue to search for the matching pre-loaded images on the network.

[0063] Among them, if the first image URL matching any of the M target image URLs is not found in the local cache, search for the matching pre-loaded image on the network based on the M target image URLs. If the first image URLs matching some of the M target image URLs are found in the local cache, search for the matching pre-loaded image on the network based on the remaining target image URLs among the M target image URLs.

[0064] In the above implementation, based on the cache situation of the pre-loaded images in memory and N target image URLs, determine M target image URLs corresponding to M pre-loaded images to be cached. First, search for image resources in the local cache based on the M target image URLs. If there are no image resources or only some image resources exist in the local cache, continue to search on the network, and load the found images into memory, so as to cache the pre-loaded images corresponding to the N target image URLs in memory to be ready for rendering and display at any time.

[0065] Whether it is the image resources obtained from the local cache or the image resources pulled from the network, image pre-loading can be performed to fully meet the increasingly complex image loading requirements of the application, with strong flexibility, and at the same time enhance the visual coherence and fluency of users during the browsing process.

[0066] It should be noted that in applications, image caching is usually divided into multiple levels, including memory caching and local caching. The image data in memory is temporary. When the application is closed or the device memory is insufficient, this data will be cleared to ensure the normal operation of the device. The local images in the local cache are stored on the persistent storage medium of the device, such as internal storage or SD card. These images remain after the application is closed or the device is restarted until they are manually cleared or replaced due to the caching policy. As the first-level cache, the advantage of memory caching is that the reading speed is the fastest because the data is directly obtained from memory, reducing unnecessary disk I / O operations. In contrast, although the reading speed of local caching (such as SD card or internal storage space) is also relatively fast, it is slower than memory access because it involves disk read and write operations. Therefore, when the application needs to load an image, if the required image exists in memory, it will be directly loaded and displayed from memory to maximize the loading speed and optimize the user experience. If it does not exist in memory, the image data will be extracted from the local cache and loaded into memory. If it does not exist in the local cache either, the image needs to be downloaded from the network. That is, in this embodiment, it is preferred to check whether the pre-loaded image exists in memory first. If not, it is first searched in the local cache and then downloaded from the network, while realizing image preloading, reasonably utilizing image resources, and avoiding unnecessary image downloads.

[0067] In an embodiment of the present application, the method further includes:

[0068] After receiving the application data corresponding to the target application, identifying the image URL in the application data based on the recognition algorithm;

[0069] Searching for the image URL carrying the preloading identifier among the identified image URLs to determine the target image URL.

[0070] In this embodiment, in the underlying code part of the network request of the target application, a special processing module is integrated. The main responsibility of this module is to dock the data returned by the network request. When the target application sends a data acquisition request to the server and receives the returned application data, this module will immediately start the traversal process. By scanning the data content line by line and using the built-in precise recognition algorithm, the image URL information can be accurately found from numerous data items. This algorithm is based on the in-depth analysis of the data structure and can quickly locate the field containing the image link, providing a data basis for subsequent loading judgment.

[0071] After identifying the image URL, searching for the image URL carrying the preloading identifier among the identified image URLs, and further determining the target image URL associated with the pre-loaded image.

[0072] By preloading and marking the image URLs, it is possible to achieve image preloading for a wide range of image resources with diverse formats, based on flexible marking strategies and underlying processing modules.

[0073] The process of triggering page display based on preloaded images is introduced below. When filling the image display area of the application page to be displayed with the preloaded images cached in memory that match the application page to be displayed, based on the image filling requirements of the application page to be displayed, it includes:

[0074] When the application page to be displayed needs to be filled with images, identify whether there is a preloaded image cached in memory that matches the application page to be displayed;

[0075] In response to the preloaded image that matches the application page to be displayed being cached, trigger a page rendering instruction;

[0076] Fill the preloaded image that matches the application page to be displayed into the corresponding image display area to render the application page to be displayed and trigger page display.

[0077] When the layout construction work of the application page to be displayed is about to be completed, that is, all text boxes, buttons, other components, etc. have been typeset according to the design, and only the image filling is left, it is necessary to identify the cache status of the preloaded image that matches the application page to be displayed, that is, detect whether there is a preloaded image cached in memory that matches the application page to be displayed. When the preloaded image that matches the application page to be displayed has been cached in memory, it is determined that the preloaded image is ready, and a page rendering instruction is immediately triggered to accurately fill the cached preloaded image that matches the application page to be displayed into the corresponding image display area, so that when the user opens the page, they can see the complete and clear image content immediately without waiting for a long time for the image to load, greatly improving the visual interaction experience.

[0078] The overall implementation process of the image loading solution of this application is introduced below, as Figure 2 shown, including:

[0079] Step 201, receive the application data corresponding to the target application sent by the server based on the data acquisition request.

[0080] Step 202, identify the image URLs in the application data based on the recognition algorithm, and search for the image URLs carrying the preloading identifier among the identified image URLs to determine N target image URLs included in the application data.

[0081] Step 203: Generate N target identifiers based on N target picture URLs, and check in the memory whether there is a picture whose unique identifier matches the target identifier, so as to identify whether there is a pre-loaded picture corresponding to the N target picture URLs cached in the memory, where the unique identifier is generated based on the picture URL. If there is a pre-loaded picture corresponding to the N target picture URLs cached in the memory, execute Step 204; otherwise, execute Step 205.

[0082] Step 204: Continue to retain the pre-loaded picture in the memory. After Step 204, execute Step 207.

[0083] Step 205: Determine M target picture URLs based on the caching situation of the pre-loaded pictures in the memory. The M target picture URLs correspond to M pre-loaded pictures to be cached, and the value of M is less than or equal to N. After Step 205, execute Step 206.

[0084] Step 206: Search for matching pre-loaded pictures in the local cache and on the network in sequence based on the M target picture URLs. After finding the M pre-loaded pictures to be cached corresponding to the M target picture URLs, cache the M pre-loaded pictures to be cached in the memory. After Step 206, execute Step 207.

[0085] Step 207: When the picture filling is required for the application page to be displayed, in response to the pre-loaded picture matching the application page to be displayed being cached, trigger a page rendering instruction, and fill the pre-loaded picture matching the application page to be displayed into the corresponding picture display area, so as to render the application page to be displayed and trigger the page display.

[0086] In the above implementation process, by pre-making pre-loading marks, the application picture loading performance is improved without major changes to the application architecture; and for different picture loading scenarios, the smooth operation of the pre-loading mechanism can be ensured based on the pre-loading mark rules, easily adapting to the picture loading requirements in different business scenarios, with strong versatility; it supports pre-loading of picture resources from different sources and in different formats, can fully meet the increasingly complex picture loading requirements of the application, and enhance the visual coherence and fluency of the user during browsing.

[0087] An embodiment of the present application provides a picture loading device, as Figure 3 shown. The device includes:

[0088] A receiving module 301, configured to receive application data corresponding to a target application sent by a server based on a data acquisition request;

[0089] A caching module 302, configured to, in response to the existence of a target picture URL associated with a pre-loaded picture in the application data, cache the pre-loaded picture in the memory according to the target picture URL;

[0090] A processing module 303, configured to fill a pre-loaded picture cached in the memory and matching the application page to be displayed into a picture display area of the application page to be displayed based on a picture filling requirement of the application page to be displayed, so as to trigger page display.

[0091] Optionally, the caching module includes:

[0092] An activation sub-module, configured to activate a pre-loading process in response to the existence of the target picture URL in the application data, where the application data includes N target picture URLs, and N is an integer greater than or equal to 1;

[0093] A first identification sub-module, configured to identify whether a pre-loaded picture corresponding to the N target picture URLs is cached in the memory;

[0094] A processing sub-module, configured to, if the pre-loaded pictures corresponding to the N target picture URLs are not cached or only some of the pre-loaded pictures corresponding to the target picture URLs are cached, extract picture data to be loaded in a local cache and / or on a network, and cache the extracted picture data to be loaded in the memory;

[0095] A retention sub-module, configured to, if the pre-loaded pictures corresponding to the N target picture URLs are cached, continue to retain the pre-loaded pictures in the memory.

[0096] Optionally, each picture cached in the memory corresponds to a unique identifier, and the unique identifier is generated based on a picture URL. The identification sub-module is further configured to:

[0097] Generate N target identifiers based on the N target picture URLs;

[0098] Search in the memory for a picture whose unique identifier matches the target identifier to identify the pre-loaded picture.

[0099] Optionally, the processing sub-module includes:

[0100] A determination unit, configured to determine M target picture URLs based on a caching condition of pre-loaded pictures in the memory, where the M target picture URLs correspond to M pre-loaded pictures to be cached, and the value of M is less than or equal to N;

[0101] A search unit, configured to sequentially search for matching pre-loaded pictures in a local cache and on a network based on the M target picture URLs, where a local picture in the local cache corresponds to a picture URL;

[0102] A cache unit, configured to cache the M preloaded pictures to be cached into the memory in response to finding the M preloaded pictures to be cached corresponding to the M target picture URLs.

[0103] Optionally, the finding unit includes:

[0104] A first finding subunit, configured to find a matching first picture URL in the picture URLs corresponding to the local pictures based on the M target picture URLs;

[0105] A determining subunit, configured to determine the local picture corresponding to the found first picture URL as a preloaded picture;

[0106] A second finding subunit, configured to, in response to not finding the first picture URLs corresponding to the M target picture URLs respectively, continue to find matching preloaded pictures on the network based on at least some of the M target picture URLs.

[0107] Optionally, the apparatus further includes:

[0108] An identification module, configured to identify the picture URLs in the application data based on an identification algorithm after receiving the application data corresponding to the target application;

[0109] A finding and determining module, configured to find the picture URLs carrying a preloading flag in the identified picture URLs to determine the target picture URLs.

[0110] Optionally, the processing module includes:

[0111] A second identification sub-module, configured to identify whether a preloaded picture matching the page to be displayed of the application has been cached in the memory when the page to be displayed of the application needs to be filled with pictures;

[0112] A triggering sub-module, configured to trigger a page rendering instruction in response to a preloaded picture matching the page to be displayed of the application having been cached;

[0113] A filling sub-module, configured to fill the preloaded picture matching the page to be displayed of the application into the corresponding picture display area to render the page to be displayed of the application and trigger page display.

[0114] For the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For related parts, refer to the partial description of the method embodiment.

[0115] The embodiments of the present application also provide an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the above-mentioned picture loading method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0116] For example, Figure 4 shows a schematic structural diagram of an electronic device. As Figure 4 shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communication interface 420, and the memory 430 complete mutual communication through the communication bus 440. The processor 410 can call the logical instructions in the memory 430. The processor 410 is used to execute each process of the picture loading method embodiment of the present application, which will not be elaborated one by one here.

[0117] In addition, when the logical instructions in the above-mentioned memory 430 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0118] The embodiments of the present application also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements each process of the above-mentioned picture loading method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here. Among them, the computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.

[0119] It should be noted that in this text, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including such element.

[0120] From the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0121] The embodiments of this application have been described above in conjunction with the accompanying drawings. However, this application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of this application, those of ordinary skill in the art can make many forms without departing from the purpose of this application and the scope protected by the claims, and all of them belong to the protection scope of this application.

[0122] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of this application can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0123] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems, devices and units can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0124] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

[0125] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] In addition, in each embodiment of the present application, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0127] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.

[0128] As described above, only the specific implementation manners of the present application are provided, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present application can easily think of changes or substitutions, which should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for loading an image, characterized in that: include: Receiving application data corresponding to the target application sent by the server based on the data acquisition request; In response to the presence of a target image URL associated with the preloaded image in the application data, caching the preloaded image in the memory according to the target image URL; Based on the image filling requirement of the application page to be displayed, the preloaded image cached in the memory and matching the application page to be displayed is filled into the image display area of ​​the application page to be displayed to trigger page display.

2. The method according to claim 1, characterized in that In response to the presence of a target image URL associated with the preloaded image in the application data, caching the preloaded image in the memory according to the target image URL includes: In response to the target image URL existing in the application data, activating a preloading process, wherein the application data includes N target image URLs, where N is an integer greater than or equal to 1; Identify whether preloaded images corresponding to the N target image URLs are cached in the memory; If the preloaded images corresponding to the N target image URLs are not cached or the preloaded images corresponding to some of the target image URLs are cached, extract the image data to be loaded from the local cache and / or the network, and cache the extracted image data to be loaded into the memory; If preloaded images corresponding to the N target image URLs are cached, the preloaded images continue to be retained in the memory.

3. The method according to claim 2, characterized in that Each image cached in the memory corresponds to a unique identifier, and the unique identifier is generated based on the image URL; The identifying whether the preloaded images corresponding to the N target image URLs are cached in the memory includes: Generate N target identifiers based on the N target image URLs; The memory is searched to see whether there is a picture whose unique identifier matches the target identifier, so as to identify the preloaded picture.

4. The method according to claim 2 or 3, characterized in that: If the preloaded images corresponding to the N target image URLs are not cached or the preloaded images corresponding to some of the target image URLs are cached, extracting the image data to be loaded from the local cache and / or the network, and caching the extracted image data to be loaded into the memory, including: Based on the cache status of the preloaded images in the memory, determine M target image URLs, where the M target image URLs correspond to the M preloaded images to be cached, and the value of M is less than or equal to N; Searching for matching preloaded images in the local cache and on the network in turn based on the M target image URLs, wherein the local image in the local cache corresponds to an image URL; In response to finding the M preloaded images to be cached corresponding to the M target image URLs, the M preloaded images to be cached are cached into the memory.

5. The method according to claim 4, characterized in that The searching for matching preloaded images in the local cache and on the network in sequence based on the M target image URLs includes: Based on the M target image URLs, searching for a matching first image URL in the image URLs corresponding to the local images; Determine the local image corresponding to the first image URL found as the preloaded image; In response to not finding the first picture URLs respectively corresponding to the M target picture URLs, continue searching for matching preloaded pictures on the network based on at least some of the M target picture URLs.

6. The method according to claim 1, characterized in that The method further comprises: After receiving the application data corresponding to the target application, identifying the image URL in the application data based on the recognition algorithm; The image URL carrying the preload identifier is searched in the identified image URLs to determine the target image URL.

7. The method according to claim 1, characterized in that The filling of the preloaded images matching the application page to be displayed and cached in the memory into the image display area of ​​the application page to be displayed based on the image filling requirement of the application page to be displayed, so as to trigger page display, includes: When the application page to be displayed needs to be filled with pictures, identifying whether a preloaded picture matching the application page to be displayed has been cached in the memory; In response to the preloaded image matching the application page to be displayed being cached, triggering a page rendering instruction; The preloaded images matching the application page to be displayed are filled into the corresponding image display area to render the application page to be displayed and trigger page display.

8. A picture loading device, characterized in that: include: A receiving module, used for receiving application data corresponding to the target application sent by the server based on the data acquisition request; a cache module, configured to cache the preloaded image in a memory according to the target image URL in response to the presence of a target image URL associated with the preloaded image in the application data; The processing module is used to fill the preloaded images cached in the memory and matching the application page to be displayed into the image display area of ​​the application page to be displayed based on the image filling requirements of the application page to be displayed, so as to trigger page display.

9. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the image loading method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the image loading method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • High-resolution image thumbnail caching and loading method and system of iOS terminal, terminal equipment and medium

    CN121188301A