WO2020199751A1 - 用于加载页面图片的方法、装置和电子设备 - Google Patents

用于加载页面图片的方法、装置和电子设备 Download PDF

Info

Publication number
WO2020199751A1
WO2020199751A1 PCT/CN2020/074438 CN2020074438W WO2020199751A1 WO 2020199751 A1 WO2020199751 A1 WO 2020199751A1 CN 2020074438 W CN2020074438 W CN 2020074438W WO 2020199751 A1 WO2020199751 A1 WO 2020199751A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
target picture
target
compressed
information
Prior art date
Application number
PCT/CN2020/074438
Other languages
English (en)
French (fr)
Inventor
邱扬
Original Assignee
北京字节跳动网络技术有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 北京字节跳动网络技术有限公司 filed Critical 北京字节跳动网络技术有限公司
Publication of WO2020199751A1 publication Critical patent/WO2020199751A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Definitions

  • the present invention relates to the field of Internet technology, and in particular to a method, device and electronic equipment for loading page pictures.
  • the page displayed on the client can include text, pictures and other information. Text information usually occupies less data traffic, while image information usually occupies more data traffic.
  • the page displayed by the client initiates a page acquisition request to the remote server through the client.
  • the server sends page data to the client according to the acquisition request, and the client loads text, picture information, etc. according to the page data sent by the server.
  • the embodiments of the present invention provide a method, a device, and an electronic device for loading page images, which to a certain extent realizes the purpose of saving data traffic and improving page response speed.
  • the embodiment of the present invention provides a method for loading a page picture consistently.
  • the method includes obtaining picture information of the target picture in response to receiving a load instruction of the target picture in the page, and the picture information includes the picture.
  • Type and picture loading address determine whether the target picture is stored locally; in response to determining that the target picture is not stored locally, obtain the target picture remotely based on the picture load address; display the target on the page And save the target picture in the local preset picture storage space, so as to display the target picture when a user's browsing request for the target picture is received after the current moment.
  • the method further includes generating loading cache information of the target picture in response to the failure of obtaining the target picture, and storing the loading cache information in a preset loading information cache space, where the loading cache information includes all The keyword corresponding to the target picture and the loading address of the target picture.
  • every preset time interval based on the keyword corresponding to the target picture, read the load cache information from the preset load information cache space, and execute the remote acquisition of the load cache information according to the load address. Operation of the target picture; if the target picture is obtained, save the target picture in a preset picture storage space, so as to display the target picture when a user's browsing request for the target picture is received.
  • the method further includes generating and saving a compressed picture of the target picture reduced in accordance with a preset ratio, so as to display the compressed picture when a user's browsing request for the compressed picture is received.
  • the compressed picture is associated with page data preset to display the compressed picture.
  • the compressed picture includes a first compressed picture and a second compressed picture, and the size of the first compressed picture is larger than the size of the second compressed picture; wherein, the first compressed picture is for the user to preview the The information of the target picture, the second compressed picture is for the user to browse the information of the target picture in the thumbnail.
  • an embodiment of the present invention provides an apparatus for loading a picture of a page, including: a picture information obtaining unit configured to obtain a picture of the target picture in response to receiving a loading instruction of the target picture in the page Information, the picture information includes the picture type and the picture loading address; the determining unit is configured to determine whether the target picture is stored locally; the picture acquiring unit is configured to respond to determining that the target picture is not stored locally, based on all The picture loading address obtains the target picture remotely; the display unit is configured to display the target picture on the page, and save the target picture in a local preset picture storage space, so as to receive it after the current moment When the user requests to browse the target picture, the target picture is displayed.
  • the device further includes a caching unit configured to: in response to the failure of obtaining the target picture, generate load cache information of the target picture, and store the load cache information in a preset load Information cache space, where the loading cache information includes the keyword corresponding to the target picture and the loading address of the target picture.
  • a caching unit configured to: in response to the failure of obtaining the target picture, generate load cache information of the target picture, and store the load cache information in a preset load Information cache space, where the loading cache information includes the keyword corresponding to the target picture and the loading address of the target picture.
  • the picture obtaining unit is further configured to: read the loading cache information from the preset loading information cache space based on the keyword corresponding to the target picture at preset time intervals, and according to the The loading address executes the operation of obtaining the target picture remotely; if the target picture is obtained, the target picture is saved in the preset picture storage space, so as to display when the user's browsing request for the target picture is received The target picture.
  • the device further includes a compression unit configured to generate and save a compressed picture of the target picture that is reduced in accordance with a preset ratio, so that when a user's browsing request for the compressed picture is received To display the compressed picture.
  • a compression unit configured to generate and save a compressed picture of the target picture that is reduced in accordance with a preset ratio, so that when a user's browsing request for the compressed picture is received To display the compressed picture.
  • the device further includes a compression unit configured to associate the compressed picture with page data preset to display the compressed picture.
  • the compressed picture includes a first compressed picture and a second compressed picture, and the size of the first compressed picture is larger than the second compressed picture; wherein, the first compressed picture is for the user to preview the target picture The second compressed picture is for the user to browse the target picture information in the thumbnail.
  • an embodiment of the present invention provides an electronic device, including: one or more processors; a storage device, used to store one or more programs, when one or more programs are executed by one or more processors , Enabling one or more processors to implement the steps of any one of the foregoing methods for loading page pictures.
  • an embodiment of the present invention provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the above methods for loading page pictures are realized.
  • the method, device, and electronic device for loading a page picture provided by the embodiments of the present invention obtain picture information of the target picture by responding to receiving a load instruction of the target picture in the page, the picture information including the picture type and the picture loading address; Then, determine whether the above-mentioned target picture is stored locally; then, in response to determining that the above-mentioned target picture is not stored locally, the target picture is obtained remotely based on the picture loading address, and finally, the target picture is displayed on the page, and the picture storage space is preset locally
  • the target picture is saved in the internal, so as to display the target picture when the user's browsing request for the target picture is received after the current time.
  • the above method can save the obtained pictures locally, so that when the above pictures are flowed later, the pictures can be obtained locally. On the one hand, it can save the repeated data consumption caused by obtaining the same picture remotely each time, and on the other hand, it can improve the page response speed.
  • Fig. 1 is a flowchart of an embodiment of a method for loading page pictures according to the present invention
  • Fig. 2 is a schematic diagram of an application scenario of the method for loading page pictures according to the present application
  • Fig. 3 is a flowchart of another embodiment of a method for loading page pictures according to the present invention.
  • FIG. 4 is a schematic structural diagram of an embodiment of an apparatus for loading page pictures according to the present invention.
  • FIG. 5 is an exemplary system architecture in which the method for loading page pictures according to an embodiment of the present invention can be applied;
  • Fig. 6 is a schematic diagram of the basic structure of an electronic device according to an embodiment of the present invention.
  • FIG. 1 shows the flow of an embodiment of the method for loading page pictures according to the present invention.
  • the method for loading page images includes the following steps:
  • Step 101 In response to receiving a loading instruction of a target picture in a page, obtain picture information of the target picture, where the picture information includes a picture type and a picture loading address.
  • the page data sent by any Internet platform to the user terminal device may include at least one picture data.
  • the above picture data may include the picture type and the picture loading address.
  • the picture type here can include picture size.
  • the picture loading address may include a uniform resource locator (Uniform Resource Locator, URL) corresponding to the picture.
  • URL Uniform Resource Locator
  • the user can send a request to browse the page to the terminal device through various operations. For example, by inputting the uniform resource locator corresponding to the page in the browser, or by clicking the application client icon set in the terminal device, a request to browse the page is sent to the terminal device.
  • the terminal device can generate a loading instruction for the target image in the page according to the received page data.
  • the target picture here may be a picture included in the page currently displayed on the display screen of the terminal device.
  • the above-mentioned loading instruction may be generated according to a user's selection operation of the position corresponding to the picture in the page.
  • the above terminal device may obtain the picture information of the target picture according to the loading instruction of the target picture, and the picture information may include the picture type and the picture loading address.
  • Picture type can include picture size classification.
  • the aforementioned picture types may include original pictures, first compressed pictures and second compressed pictures.
  • the size of the first compressed picture is smaller than the size of the original picture
  • the size of the second compressed picture is smaller than the size of the first compressed picture.
  • the original image here may refer to the uncompressed, original size image provided by the page developer.
  • the URLs corresponding to the original picture, the first compressed picture, and the second compressed picture may be different.
  • the aforementioned terminal device may obtain the picture information of the aforementioned target picture from the received page data.
  • Step 102 Determine whether a target picture is stored locally.
  • the aforementioned terminal device can determine whether the target picture is stored locally.
  • the target picture is stored locally based on the picture identifier generated by the URL corresponding to the target picture.
  • the aforementioned picture identifier may be a combination of numbers, characters, or a combination of numbers and characters.
  • a preset picture identifier generation method may be used to generate the picture identifier of the target picture, and then the picture identifier is matched in the local storage space. If the matching is successful, it is determined that the target picture is stored locally, otherwise it is determined that no target picture is stored.
  • Step 103 in response to determining that there is no target image stored locally, obtain the target image remotely based on the image loading address.
  • the terminal device may remotely acquire the target picture through various wired or wireless connection methods based on the picture loading address of the aforementioned target picture.
  • the terminal device downloads the above-mentioned target picture from the remote server via the network.
  • Step 104 If the target picture is successfully obtained, display the target picture on the page, and save the target picture in the local preset picture storage space, so as to display the target picture when the user's browsing request for the target picture is received after the current time.
  • the target picture may be rendered at a position corresponding to the target picture on the page, so as to display the above-mentioned target picture on the page.
  • Page rendering is a well-known technology that is currently widely researched and applied, and will not be repeated here.
  • the terminal device may save the target picture in the local budget picture storage space, so as to display the target picture when a user's browsing request for the target picture is received after the current time. In this way, the traffic consumed by repeatedly obtaining image resources remotely can be saved.
  • the page can be rendered directly based on the pictures and other data stored locally, which can speed up the display of the page.
  • the method provided by the above-mentioned embodiment of the present invention obtains picture information of the target picture by responding to receiving a load instruction of the target picture in the page, the picture information includes the picture type and the picture loading address; then, it is determined whether the above-mentioned target picture is stored locally ; Next, in response to determining that the above-mentioned target picture is not stored locally, the target picture is obtained remotely based on the picture loading address, and finally, the target picture is displayed on the page, and the target picture is saved in the local preset picture storage space to be after the current moment When receiving the user's browsing request for the target picture, the target picture is displayed.
  • the above method can save the obtained picture locally, so that when the above picture is flowed later, the picture can be obtained locally. On the one hand, it can save the traffic consumed every time the picture is obtained remotely, and on the other hand, it can improve the display page information. speed.
  • the above method for loading page pictures may further include: generating and saving a compressed picture of the target picture that is reduced in accordance with a preset ratio, so as to receive a user’s comment on the compressed picture Show compressed pictures when browsing requests.
  • the target picture in the page after the target picture in the page is obtained, the target picture can be reduced according to a preset ratio, thereby generating a compressed picture of the target picture.
  • the terminal device may also save the compressed picture of the above-mentioned target picture locally.
  • the compressed picture may be displayed.
  • the above method for loading a page picture may further include associating the compressed picture with page data displaying the compressed picture.
  • the compressed image of the target image (herein referred to as the original image) is displayed on the page where the compressed image of the target image is displayed may be different from the page where the target image is displayed.
  • Data is associated.
  • the uniform resource locator for displaying the compressed picture can be associated with the identifier of the compressed picture stored locally. In this way, when receiving the user’s instruction to display the compressed picture page of the target picture, the compressed picture of the target picture can be directly obtained locally, without the need to remotely obtain the above-mentioned target picture according to the load address corresponding to the compressed picture of the target picture Compress images, so that you can further save data traffic and improve the speed of page response.
  • the above-mentioned compressed picture may include a first compressed picture and a second compressed picture.
  • the size of the first compressed picture is larger than the size of the second compressed picture; wherein the first compressed picture is used by the user to preview the information of the target picture, 2. Compress the picture for the user to browse the information of the target picture in the thumbnail.
  • FIG. 2 shows a flowchart of still another embodiment of a method for loading a page picture.
  • the process of the method for loading page pictures includes the following steps:
  • Step 201 In response to receiving a loading instruction of the target picture in the page, obtain picture information of the target picture, the picture information including the picture type and the picture loading address.
  • Step 201 is the same as step 101 in the embodiment shown in FIG. 1, and will not be repeated here.
  • Step 202 Determine whether a target picture is stored locally.
  • Step 202 is the same as step 102 in the embodiment shown in FIG. 1, and will not be repeated here.
  • Step 203 in response to determining that there is no target image stored locally, obtain the target image remotely based on the image loading address.
  • Step 203 is the same as step 103 in the embodiment shown in FIG. 1, and will not be repeated here.
  • Step 204 If the target picture is successfully acquired, display the target picture on the page, and save the target picture in the local preset picture storage space, so as to display the target picture when a user's browsing request for the target picture is received after the current moment.
  • Step 204 is the same as step 104 in the embodiment shown in FIG. 1, and will not be repeated here.
  • Step 205 If obtaining the target picture fails, generate load cache information of the target picture, and store the load cache information in a preset load information cache space.
  • the load cache information includes the keyword corresponding to the target picture and the load address of the target picture.
  • loading cache information of the target picture may be generated.
  • the aforementioned loading cache information may include keywords corresponding to the target image and the loading address of the target image.
  • the keyword corresponding to the target picture here may be generated based on the load address corresponding to the target picture.
  • the keyword corresponding to the target picture here may be the use of a hash algorithm to generate a hash value for the above loading address, etc.
  • the loading information cache space can be set in advance.
  • the loading cache information of the image can be generated first.
  • the above-mentioned loading cache information may also include the identifier of the page corresponding to the image, and the location data in the above-mentioned page. In this way, any load cache information can be read directly from the load information cache space, and after the corresponding picture is obtained according to the load address indicated by the load cache information, the page identification, location data, etc. in the load cache information can be obtained. Associate the obtained picture to the corresponding position on the above page.
  • the size of the aforementioned preset loading information cache space may be fixed. It can be determined whether the information stored in the preset loading information cache space has exceeded the preset limit every preset time interval or before each new loading cache information is stored in the preset loading information cache space.
  • the preset limit is to delete a preset number of pre-stored load cache information in descending order of the storage time.
  • Step 206 Read the loading cache information from the preset loading information cache space based on the keyword corresponding to the target picture at preset time intervals, and execute the operation of obtaining the target picture remotely according to the loading address.
  • the aforementioned preset time interval can be any time interval, such as 1 second, 3 seconds, 5 seconds, and so on.
  • the specific time interval can be set according to specific application scenarios, and is not limited here.
  • the target picture loading cache information can be saved in the preset loading information cache space. After that, the picture loading cache information of the target picture may be read from the preset loading information cache space at a preset time interval, and the operation of obtaining the target picture remotely may be performed. Until the target picture is obtained.
  • Step 207 If the target picture is obtained, save the target picture in a preset picture storage space, so as to display the target picture when a user's browsing request for the target picture is received.
  • the target picture obtained according to the picture loading cache information may be saved.
  • the target map can be displayed. For example, the above target image is displayed on the page where the target image is located. Or according to the user's demand instruction, the above target picture is displayed separately.
  • the flow of the method for loading page pictures in this embodiment highlights that if the target picture fails to be obtained, the load cache information of the target picture is cached.
  • the step of obtaining the picture is performed according to the cached loading cache information. Since the target picture can be actively obtained according to the cached loading cache information, the target picture is saved after being obtained, and the target picture is displayed after receiving the corresponding instruction from the user.
  • the solution provided in this embodiment obtains in the background the pictures that the user has not successfully loaded according to the user's instruction during the current visit, and displays these pictures when the user browses again. Since the display timing of the information acquired in the background matches the user's needs, the user experience can be further improved.
  • the above method for loading page pictures may further include: generating and saving a compressed picture of the target picture that is reduced in accordance with a preset ratio, so as to receive the user's browsing of the compressed picture When requested, display compressed images.
  • the above method for loading a page picture may further include generating and saving a compressed picture of the target picture that is reduced according to a preset ratio, so as to display the compressed picture when receiving a user's browsing request for the compressed picture.
  • the above-mentioned method for loading a page picture may further include associating the compressed picture with page data preset to display the compressed picture.
  • the compressed picture includes a first compressed picture and a second compressed picture.
  • the size of the first compressed picture is larger than the size of the second compressed picture.
  • the first compressed picture is for the user to preview the information of the target picture
  • the second compressed picture The picture is for users to browse the information of the target picture in the thumbnail.
  • step 301 an instruction to obtain the target picture may be received, the operation of obtaining the target picture may be performed, and then in step 302, it is determined whether the target picture is successfully obtained. If successful, perform step 303 to display the target picture on the page, and save the target picture in the local preset picture storage space, so as to display the target picture when the user's browsing request for the target picture is received after the current time. If it is unsuccessful, proceed to perform the operations of steps 304 to 306.
  • Step 304 Generate loading cache information of the target picture, and store the loading cache information in a preset loading information cache space.
  • the loading cache information includes the keyword corresponding to the target picture and the loading address of the target picture.
  • Step 305 Read the loading cache information from the preset loading information cache space based on the keyword corresponding to the target picture at preset time intervals, and execute the operation of obtaining the target picture remotely according to the loading address.
  • Step 306 If the target picture is obtained, save the target picture in the budget picture storage space, so as to display the target picture when the user's browsing request for the target picture is received.
  • the target picture can be further analyzed and processed, for example, a compressed picture of the target picture is generated for the user to browse the preview of the picture, or for the user to browse the picture in the list.
  • the present invention provides an embodiment of a device for loading page pictures, and the device embodiment corresponds to the method embodiment shown in FIG. 1,
  • the device can be applied to various electronic devices.
  • the apparatus for loading page pictures in this embodiment includes: a picture information acquiring unit 401, a determining unit 402, a picture acquiring unit 403, and a displaying unit 404.
  • the picture information obtaining unit 401 is configured to obtain picture information of the target picture in response to receiving a loading instruction of the target picture in the page, the picture information includes the picture type and the picture loading address;
  • the determining unit 402 is configured to determine the local Whether the target picture is stored;
  • the picture obtaining unit 403 is configured to obtain the target picture remotely based on the picture loading address in response to determining that there is no target picture stored locally;
  • the display unit 404 is configured to display the target picture on the page and locally
  • the target picture is stored in the preset picture storage space to display the target picture when a user's browsing request for the target picture is received after the current moment.
  • step 101, step 102, step 103 and step 104 in the example will not be repeated here.
  • the apparatus 400 for loading page pictures further includes a caching unit, and the caching unit is configured to: in response to a failure to obtain the target picture, generate load cache information of the target picture, and load The cache information is stored in the preset loading information cache space, and the loading cache information includes the keyword corresponding to the target image and the loading address of the target image.
  • the picture acquisition unit is further configured to: read the load cache information from the preset load information cache space based on the keyword corresponding to the target picture according to the preset time interval, and according to the load The address executes the operation of obtaining the target picture from a remote location; if the target picture is obtained, the target picture is saved in the preset picture storage space to display the target picture when the user's browsing request for the target picture is received.
  • the apparatus 400 for loading page pictures further includes a compression unit (not shown in the figure), and the compression unit is configured to: generate a target picture that is compressed according to a preset scale. The picture is saved, so as to display the compressed picture when the user's browsing request for the compressed picture is received.
  • the apparatus 400 for loading a page picture further includes an associating unit configured to associate the compressed picture with page data preset to display the compressed picture.
  • the compressed picture includes a first compressed picture and a second compressed picture, and the size of the first compressed picture is larger than the second compressed picture; wherein, the first compressed picture is used by the user to preview the target picture. Information, the second compressed picture for the user to browse the information of the target picture in the thumbnail.
  • FIG. 5 shows an exemplary system architecture in which the method for loading page pictures according to an embodiment of the present invention can be applied.
  • the system architecture may include terminal devices 501, 502, and 503, a network 504, and a server 505.
  • the network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505.
  • the network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the terminal devices 501, 502, and 503 can interact with the server 505 via the network 504 to receive or send messages and so on.
  • Various client applications may be installed on the terminal devices 501, 502, and 503, such as web browser applications, search applications, and news applications.
  • the terminal devices 501, 502, and 503 may be various electronic devices with display screens, including but not limited to smart phones, tablet computers, laptop and desktop computers, e-book readers, and so on.
  • the terminal devices 501, 42, and 503 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules for providing distributed services), or the like.
  • the terminal devices 501, 502, and 503 may receive information browsing instructions from users, and the information browsing instructions may include page browsing instructions.
  • the terminal device can determine the page data information according to the data returned by the information browsing instruction.
  • the server 505 may provide various services, such as receiving information acquisition requests sent by the terminal devices 501, 502, and 503, analyzing and processing the information acquisition requests, and sending analysis and processing results (such as page data information) to the terminal device.
  • the method for loading page pictures provided in the embodiments of the present invention is generally executed by terminal devices 501, 502, and 503. Accordingly, the device for loading page pictures is generally set on terminal devices 501, 502, 503. in.
  • terminal devices, networks, and servers in FIG. 5 are merely illustrative. According to implementation needs, there can be any number of terminal devices, networks and servers.
  • FIG. 6 shows a schematic diagram of the basic structure of an electronic device suitable for implementing the embodiments of the present invention.
  • the electronic device shown in FIG. 6 is only an example, and should not bring any limitation to the function and application scope of the embodiment of the present invention.
  • the electronic device may include one or more processors 601 and a storage device 602.
  • the user of the storage device 602 stores one or more programs.
  • One or more programs in the storage device 602 may be executed by one or more processors 601.
  • the one or more processors can implement the above-mentioned functions defined in the method of the present invention.
  • the modules involved in the described embodiments of the present invention can be implemented in software or hardware.
  • the described module may also be provided in the processor, for example, it may be described as: a processor includes a picture information acquisition unit, a determination unit, a picture acquisition unit, and a display unit.
  • a processor includes a picture information acquisition unit, a determination unit, a picture acquisition unit, and a display unit.
  • the names of these modules do not constitute a limitation on the module itself under certain circumstances.
  • the picture information acquisition unit can also be described as "in response to receiving the load instruction of the target picture in the page, the target picture Picture information unit".
  • the present invention also provides a computer-readable medium.
  • the computer-readable medium may be included in the device described in the foregoing embodiment; or it may exist alone without being assembled into the device.
  • the computer-readable medium of the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above.
  • Computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory erasable Programmable read only memory
  • CD-ROM portable compact disk read only memory
  • magnetic storage device or any suitable combination of the above.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the device When the above-mentioned one or more programs are executed by the device, the device is caused to: in response to receiving the loading instruction of the target image in the page, obtain the image information of the target image, The picture information includes the picture type and picture loading address; determine whether the target picture is stored locally; in response to determining that there is no target picture stored locally, the target picture is obtained remotely based on the picture load address; if the target picture is obtained successfully, the target picture is displayed on the page, And save the target picture in the local preset picture storage space to display the target picture when the user's browsing request for the target picture is received after the current moment.

Abstract

用于加载页面图片的方法、装置和电子设备。方法包括:响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址(101);确定本地是否存储有目标图片(102);响应于确定本地无存储目标图片,基于图片加载地址从远程获取目标图片(103);若获取目标图片成功,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片(104)。可以节省流量,提高页面响应速度。

Description

用于加载页面图片的方法、装置和电子设备
相关申请的交叉引用
本申请要求于2019年04月03日提交的,申请号为201910267547.0、发明名称为“用于加载页面图片的方法、装置和电子设备”的中国专利申请的优先权,该申请的全文通过引用结合在本申请中。
技术领域
本发明涉及互联网技术领域,尤其涉及一种用于加载页面图片的方法、装置和电子设备。
背景技术
在客户端展示的页面中可以包括文字、图片等信息。文字信息通常所占用的数据流量较少,而图片信息所占用的数据流量通常较大。目前客户端展示的页面是通过客户端向远程服务器发起页面获取请求,服务器根据获取请求向客户端发送页面数据,客户端根据服务器所发送的页面数据来加载文字、图片信息等。
由于图片信息所占用的数据流量较大,当网络不稳定时,有可能客户端无法及时从远程服务器下载图片。另外,对于已经下载的图片,对应的该图片的页面展示完成后,丢弃该图片。当用户后续再想浏览该图片时,只能从远程重新下载该图片。这样的加载方式,所需的流量较大,另外,页面响应速度也较慢。
发明内容
本发明实施例提供了一种用于加载页面图片的方法、装置和电子设备,在一定程度上实现了节省数据流量,提升页面响应速度的目的。
第一方面,本发明实施例提供了一致用于加载页面图片的方法, 该方法包括响应于接收到页面中的目标图片的加载指令,获取所述目标图片的图片信息,所述图片信息包括图片类型与图片加载地址;确定本地是否存储有所述目标图片;响应于确定本地无存储所述目标图片,基于所述图片加载地址从远程获取所述目标图片;在所述页面中展示所述目标图片,并在本地预设图片存储空间内保存所述目标图片,以在当前时刻之后接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
可选地,该方法还包括响应于所述目标图片获取失败,生成所述目标图片的加载缓存信息,并将所述加载缓存信息存入预设加载信息缓存空间,所述加载缓存信息包括所述目标图片所对应的关键字以及所述目标图片的加载地址。
可选地,每隔预设时间间隔,基于所述目标图片对应的关键字从所述预设加载信息缓存空间中读取所述加载缓存信息,并根据所述加载地址执行从远程获取所述目标图片的操作;若获取到所述目标图片,将所述目标图片保存在预设图片存储空间,以在接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
可选地,该方法还包括生成所述目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对所述压缩图片的浏览请求时,展示所述压缩图片。
可选地,将所述压缩图片与预设展示所述压缩图片的页面数据进行关联。
可选地,所述压缩图片包括第一压缩图片和第二压缩图片,所述第一压缩图片的大小大于所述第二压缩图片的大小;其中,所述第一压缩图片供用户预览所述目标图片的信息,所述第二压缩图片供用户在缩略图中浏览所述目标图片的信息。
第二方面,本发明实施例提供了一种用于加载页面图片的装置,包括:图片信息获取单元,配置用于响应于接收到页面中的目标图片的加载指令,获取所述目标图片的图片信息,所述图片信息包括图片类型与图片加载地址;确定单元,配置用于确定本地是否存储有所述目标图片;图片获取单元,配置用于响应于确定本地无存储所述目标 图片,基于所述图片加载地址从远程获取所述目标图片;展示单元,配置用于在所述页面中展示所述目标图片,并在本地预设图片存储空间内保存所述目标图片,以在当前时刻之后接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
可选地,该装置还包括缓存单元,所述缓存单元配置用于:响应于所述目标图片获取失败,生成所述目标图片的加载缓存信息,并将所述加载缓存信息存入预设加载信息缓存空间,所述加载缓存信息包括所述目标图片所对应的关键字以及所述目标图片的加载地址。
可选地,图片获取单元进一步配置用于:每隔预设时间间隔,基于所述目标图片对应的关键字从所述预设加载信息缓存空间中读取所述加载缓存信息,并根据所述加载地址执行从远程获取所述目标图片的操作;若获取到所述目标图片,将所述目标图片保存在预设图片存储空间,以在接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
可选地,该装置还包括压缩单元,所述压缩单元配置用于:生成所述目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对所述压缩图片的浏览请求时,展示所述压缩图片。
可选地,该装置还包括压缩单元,所述压缩单元配置用于:将所述压缩图片与预设展示所述压缩图片的页面数据进行关联。
可选地,所述压缩图片包括第一压缩图片和第二压缩图片,所述第一压缩图片的大小大于所述第二压缩图片;其中,所述第一压缩图片供用户预览所述目标图片的信息,所述第二压缩图片供用户在缩略图中浏览所述目标图片的信息。
第三方面,本发明实施例提供了一种电子设备,包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现上述任意一种用于加载页面图片的方法的步骤。
第四方面,本发明实施例提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现上述任意一种用于加载页面图片的方法的步骤。
本发明实施例提供的用于加载页面图片的方法、装置和电子设备,通过响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址;然后,确定本地是否存储有上述目标图片;接着,响应于确定本地无存储上述目标图片,基于图片加载地址从远程获取目标图片,最后,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。上述方法可以将获取图片的在本地保存,从而在之后流量上述图片时,可以在本地获取上图片,一方面可以节省每次从远程获取同一图片引起的重复流量消耗,另一方面可以提升页面响应速度。
附图说明
附图用于更好地理解本发明,不构成对本发明的不当限定。其中:
图1是根据本发明的用于加载页面图片的方法的一个实施例的流程图;
图2是根据本申请的用于加载页面图片的方法的一个应用场景的示意图;
图3是根据本发明的用于加载页面图片的方法的又一个实施例的流程图;
图4是根据本发明的用于加载页面图片的装置的一个实施例的结构示意图;
图5是本发明的一个实施例的用于加载页面图片的方法可以应用于其中的示例性系统架构;
图6是根据本发明实施例提供的电子设备的基本结构的示意图。
具体实施方式
以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解。应当将它们认为仅仅是示范性的。因此本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。
需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。
请参考图1,其示出了根据本发明的用于加载页面图片的方法的一个实施例的流程。如图1所示该用于加载页面图片的方法,包括以下步骤:
步骤101,响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址。
在本实施例中,任一互联网平台向用户终端设备发送的页面数据中可以包括至少一个图片数据。上述图片数据可以包括图片类型以及图片加载地址。这里的图片类型可以包括图片大小。图片加载地址可以包括图片对应的统一资源定位符(Uniform Resource Locator,URL)。
用户可以通过各种操作向用终端设备发出浏览页面的请求。例如通过在浏览器中输入页面对应的统一资源定位符的操作,或者通过点击设置在终端设备中的应用客户端图标的操作向终端设备发出浏览页面的请求。终端设备可以根据所接收的页面数据进而生成对页面中的目标图片的加载指令。这里的目标图片可以是终端设备的显示屏幕当前展示的页面所包括的图片。
在一些应用场景中,上述加载指令可以是根据用户对页面中的图片所对应的位置的选择操作生成的。
上述终端设备可以根据目标图片的加载指令,获取目标图片的图片信息,上述图片信息可以包括图片类型与图片加载地址。
图片类型可以包括图片大小分类。在一些应用场景中,上述图片类型可以包括原图,第一压缩图片和第二压缩图片。第一压缩图片的大小小于原图的大小,第二压缩图片的大小小于第一压缩图片的大小。这里的原图可以是指页面开发者所提供的没有经过压缩的、具有原始尺寸的图片。
通常,对于同一图片而言,原图、第一压缩图片、第二压缩图片分别对应的URL可以不相同。
上述终端设备可以在所接收到的页面数据中获取上述目标图片的图片信息。
步骤102,确定本地是否存储有目标图片。
在本实施例中,上述终端设备可以确定本地是否存储有目标图片。
例如根据上述目标图片所对应的URL所生成的图片标识符来确定本地是否存储有上述目标图片。上述图片标识符可以为数字组合、字符组合或者数字和字符的组合等。
具体地,可以使用预设图片标识符生成方法生成目标图片的图片标识符,然后将图片标识符在本地存储空间内进行匹配。若匹配成功,则确定本地存储有目标图片,否则确定无存储目标图片。
步骤103,响应于确定本地无存储目标图片,基于图片加载地址从远程获取目标图片。
在本实施例中,若步骤102确定本地无存储上述目标图片,则终端设备可以基于上述目标图片的图片加载地址通过各种有线或无线连接方式从远程获取目标图片。
也就是说,根据图片的加载地址,终端设备通过网络从远程服务器中下载上述目标图片。
步骤104,若获取目标图片成功,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。
在本实施例中,若在步骤103中获取到目标图片,可以在页面中的目标图片对应的位置处对目标图片进行渲染,从而在页面中展现上述目标图片。页面渲染是目前广泛研究和应用的公知技术,此处不赘述。
此外,在获取到目标图片之后,上述终端设备可以在本地预算图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示上述目标图片。这样,可以节省反复从远程获取图片资源所消耗的流量。另一方面,在用户第二次浏览同一页面时,可以直接根据存储在本地的图片以及其他的数据来渲染页面,从而可以加快展现页面的速度。
本发明的上述实施例提供的方法通过响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类 型与图片加载地址;然后,确定本地是否存储有上述目标图片;接着,响应于确定本地无存储上述目标图片,基于图片加载地址从远程获取目标图片,最后,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。上述方法可以将获取图片的在本地保存,从而在之后流量上述图片时,可以在本地获取上图片,一方面可以节省每次从远程获取图片而消耗的流量,另一方面可以提升展示页面信息的速度。
在本实施例的一些可选的实现方式中,上述用于加载页面图片的方法还可以包括:生成目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对所述压缩图片的浏览请求时,展示压缩图片。
在这些可选的实现方式中,在获取到页面中的目标图片之后,可以按照预设比例来缩小目标图片,从而生成目标图片的压缩图片。此外,终端设备还可以将上述目标图片的压缩图片保存在本地。当接收到用户对上述目标图片的压缩图片的浏览请求时,可以展示上述压缩图片。
进一步可选地,上述用于加载页面图片的方法还可以包括将所述压缩图片与展示压缩图片的页面数据进行关联。
在这些可选的实现方式中,展示目标图片(这里指原图)的压缩图片的展示目标图片的压缩图片的页面可以与展示目标图片的页面不相同,可以将压缩图片与展示压缩图片的页面数据进行关联。例如可以将展示压缩图片的统一资源定位符与本地保存的压缩图片的标识符进行关联。这样,当接收到用户的展示目标图片的压缩图片的页面的指令时,可以直接从本地获取目标图片的压缩图片,而不需要根据目标图片的压缩图片对应的加载地址从远程获取上述目标图片的压缩图片,这样一来可以进一步节省数据流量,提高页面响应的速度。
在一些应用场景中,上述压缩图片可以包括第一压缩图片和第二压缩图片,第一压缩图片的大小大于第二压缩图片的大小;其中,第一压缩图片供用户预览目标图片的信息,第二压缩图片供用户在缩略图中浏览所述目标图片的信息。
进一步参考图2,其示出了用于加载页面图片的方法的又一个实施例的流程图。如图2所示,该用于加载页面图片的方法的流程,包括以下步骤:
步骤201,响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址。
步骤201与图1所示实施例中的步骤101相同,此处不赘述。
步骤202,确定本地是否存储有目标图片。
步骤202与图1所示实施例中的步骤102相同,此处不赘述。
步骤203,响应于确定本地无存储目标图片,基于图片加载地址从远程获取目标图片。
步骤203与图1所示实施例中的步骤103相同,此处不赘述。
步骤204,若获取目标图片成功,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。
步骤204与图1所示实施例中的步骤104相同,此处不赘述。
步骤205,若获取目标图片失败,生成目标图片的加载缓存信息,并将加载缓存信息存入预设加载信息缓存空间,加载缓存信息包括目标图片所对应的关键字以及目标图片的加载地址。
在本实施例中,若在步骤203中从远程获取目标图片失败,可以生成目标图片的加载缓存信息。上述加载缓存信息可以包括目标图片所对应的关键字以及目标图片的加载地址。这里的目标图片所对应的关键字可以是基于目标图片对应的加载地址生成的。这里的目标图片所对应的关键字可以是使用哈希算法对上述加载地址生成哈希值等。
可以预先设置加载信息缓存空间,当根据图片的加载地址从远程获取图片失败后,可以首先生成该图片的加载缓存信息。上述加载缓存信息除了包括图片对应的关键字以及图片的加载地址之外,还可以包括图片对应的页面的标识、以及在上述页面中的位置数据等。这样一来,可以直接从加载信息缓存空间中读取任一加载缓存信息,根据该加载缓存信息所指示的加载地址获取到相应图片之后,可以根据加 载缓存信息中的页面的标识、位置数据中等将所获得的图片关联至上述页面的相应位置。
在本实施例中,上述预设加载信息缓存空间的大小可以固定。可以每隔预设时间间隔,或在每次向预设加载信息缓存空间中存储新的加载缓存信息之前,确定上述预设加载信息缓存空间中所存储的信息是否已经超出预设限制,若超出预设限制,则按照存储的时间从长到短的顺序删除预设数量的预先存储的加载缓存信息。
步骤206,每隔预设时间间隔,基于目标图片对应的关键字从预设加载信息缓存空间中读取加载缓存信息,并根据加载地址执行从远程获取目标图片的操作。
在本实施例中,可以每隔预设时间间隔,根据目标图片对应的关键字从预设加载信息缓存空间中读取至少一个加载缓存信息,根据加载缓存信息所指示的加载地址,执行从远程获取目标图片的操作。
上述预设时间间隔可以为任意时间间隔,例如1秒、3秒、5秒等。具体的时间间隔可以根据具体的应用场景进行设定,此处不进行限定。
也就是说,对于页面中的目标图片,当首次加载页面中的目标图片不成功的情况下,可以将目标图片加载缓存信息保存到预设加载信息缓存空间中。之后,可以每隔预设时间间隔可以从预设加载信息缓存空间中读取该目标图片的图片加载缓存信息,并执行从远程获取该目标图片的操作。直至获取到该目标图片。
步骤207,若获取到目标图片,将目标图片保存在预设图片存储空间,以在接收到用户对目标图片的浏览请求时,展示目标图片。
在本实施例中,可以对根据图片加载缓存信息获取的目标图片进行保存。当在接收到用户对目标图的浏览请求时,可以展示上述目标图。例如在目标图片所在的页面中展示上述目标图片。或者根据用户的需求指令,单独展现上述目标图片。
从图2中可以看出,与图1对应的实施例相比,本实施例中的用于加载页面图片的方法的流程突出了若获取目标图片失败,对目标图片的加载缓存信息进行缓存,并根据缓存的加载缓存信息执行获取图片的操作的步骤,由于可以根据缓存的加载缓存信息主动获取目标图 片,当获取到目标图片之后进行保存,在接收到用户的相应指令后展示上述目标图片。本实施例所提供的方案在节省流量的基础上,在后台获取用户本次访问过程内未根据用户指令加载成功的图片,并在用户再次浏览这些图片时进行展现。由于在后台所获取的信息的展现时机与用户需求贴合,可以进一步改善用户体验。
在本实施例的一些可选的实现方式中,上述用于加载页面图片的方法还可以包括:生成目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对压缩图片的浏览请求时,展示压缩图片。
进一步可选地,上述用于加载页面图片的方法还可以包括生成目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对压缩图片的浏览请求时,展示压缩图片。
进一步可选地,上述用于加载页面图片的方法还可以包括将压缩图片与预设展示压缩图片的页面数据进行关联。
在一些应用场景中,压缩图片包括第一压缩图片和第二压缩图片,第一压缩图片的大小大于第二压缩图片的大小;其中,第一压缩图片供用户预览目标图片的信息,第二压缩图片供用户在缩略图中浏览目标图片的信息。
请参考图3,其示出了本发明的一个原理性流程图。如图3所示,在步骤301时,可以接收获取目标图片的指令,执行获取目标图片的操作,然后在步骤302判断获取目标图片是否成功。若成功,执行步骤303操作,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示该目标图片。若不成功,则进入执行步骤304~306的操作。步骤304,生产目标图片的加载缓存信息,并将加载缓存信息存入预设加载信息缓存空间,加载缓存信息包括目标图片所对应的关键字以及目标图片的加载地址。步骤305,每隔预设时间间隔,基于目标图片对应的关键字从预设加载信息缓存空间中读取加载缓存信息,根据加载地址执行从远程获取目标图片的操作。步骤306,若获取到目标图片,将目标图片保存在预算图片存储空间,以在接收到用户对目标图片的浏览请求时,展示目标图片。此外,还可以进一步对目标图片 进行分析处理,例如生成目标图片的压缩图片,以供用户浏览图片的预览图,或者供用户在列表中浏览图片等。
进一步参考图4,作为对上述各图所示方法的实现,本发明提供了一种用于加载页面图片的装置的一个实施例,该装置实施例与图1所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。
如图4所示,本实施例的用于加载页面图片的装置包括:图片信息获取单元401、确定单元402、图片获取单元403和展示单元404。其中,图片信息获取单元401,配置用于响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址;确定单元402,配置用于确定本地是否存储有目标图片;图片获取单元403,配置用于响应于确定本地无存储目标图片,基于图片加载地址从远程获取目标图片;展示单元404,配置用于在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。
在本实施例中,用于加载页面图片的装置的图片信息获取单元401、确定单元402、图片获取单元403和展示单元404的具体处理及其所带来的技术效果可分别参考图1对应实施例中步骤101、步骤102、步骤103和步骤104的相关说明,在此不再赘述。
在本实施例的一些可选的实现方式中,用于加载页面图片的装置400还包括缓存单元,缓存单元配置用于:响应于目标图片获取失败,生成目标图片的加载缓存信息,并将加载缓存信息存入预设加载信息缓存空间,加载缓存信息包括目标图片所对应的关键字以及目标图片的加载地址。
在本实施例的一些可选的实现方式中,图片获取单元进一步配置用于:根据预设时间间隔,基于目标图片对应的关键字从预设加载信息缓存空间中读取加载缓存信息,根据加载地址执行从远程获取目标图片的操作;若获取到目标图片,将目标图片保存在预设图片存储空间,以在接收到用户对目标图片的浏览请求时,展示目标图片。
在本实施例的一些可选的实现方式中,用于加载页面图片的装置400还包括压缩单元(图中未示出),压缩单元配置用于:生成目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对压缩图片的浏览请求时,展示压缩图片。
在本实施例的一些可选的实现方式中,用于加载页面图片的装置400还包括关联单元,关联单元配置用于:将压缩图片与预设展示压缩图片的页面数据进行关联。
在本实施例的一些可选的实现方式中,压缩图片包括第一压缩图片和第二压缩图片,第一压缩图片的大小大于第二压缩图片;其中,第一压缩图片供用户预览目标图片的信息,第二压缩图片供用户在缩略图中浏览目标图片的信息。
请参考图5,图5示出了本发明的一个实施例的用于加载页面图片的方法可以应用于其中的示例性系统架构。
如图5所示,系统架构可以包括终端设备501、502、503,网络504和服务器505。网络504用以在终端设备501、502、503和服务器505之间提供通信链路的介质。网络504可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
终端设备501、502、503可以通过网络504与服务器505交互,以接收或发送消息等。终端设备501、502、503上可以安装有各种客户端应用,例如网页浏览器应用、搜索类应用、新闻资讯类应用。
终端设备501、502、503可以是具有显示屏的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机、电子书阅读器等等。当终端设备501、42、503为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供分布式服务的软件或软件模块),也可以等等。
终端设备501、502、503可以接收用户的信息浏览指令,信息浏览指令可以包括页面浏览指令。终端设备可以根据信息浏览指令所返回的数据中,确定页面数据信息。
服务器505可以提供各种服务,例如接收终端设备501、502、503 发送的信息获取请求,对信息获取请求进行分析处理,将分析处理结果(例如页面数据信息)发送给终端设备。
需要说明的是,本发明实施例所提供的用于加载页面图片的方法一般由终端设备501、502、503执行,相应地,用于加载页面图片的装置一般设置于终端设备501、502、503中。
应该理解,图5中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
下面参考图6,其示出了适于用来实现本发明实施例的电子设备的基本结构示意图。图6示出的电子设备仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。
如图6所示,电子设备可以包括一个或多个处理器601,存储装置602。存储装置602用户存储一个或多个程序。存储装置602中的一个或多个程序可以被一个或多个处理器601执行。当一个或多个程序被一个或多个处理器执行时,使得一个或多个处理器可以实现本发明的方法中限定的上述功能。
描述于本发明实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的模块也可以设置在处理器中,例如,可以描述为:一种处理器包括图片信息获取单元、确定单元、图片获取单元和展示单元。其中,这些模块的名称在某种情况下并不构成对该模块本身的限定,例如,图片信息获取单元还可以被描述为“响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息的单元”。
作为另一方面,本发明还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中。本发明的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个 导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该设备执行时,使得该设备:响应于接收到页面中的目标图片的加载指令,获取目标图片的图片信息,图片信息包括图片类型与图片加载地址;确定本地是否存储有目标图片;响应于确定本地无存储目标图片,基于图片加载地址从远程获取目标图片;若获取目标图片成功,在页面中展示目标图片,并在本地预设图片存储空间内保存目标图片,以在当前时刻之后接收到用户对目标图片的浏览请求时,展示目标图片。
上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。

Claims (14)

  1. 一种用于加载页面图片的方法,其特征在于,包括:
    响应于接收到页面中的目标图片的加载指令,获取所述目标图片的图片信息,所述图片信息包括图片类型与图片加载地址;
    确定本地是否存储有所述目标图片;
    响应于确定本地无存储所述目标图片,基于所述图片加载地址从远程获取所述目标图片;
    若获取所述目标图片成功,在所述页面中展示所述目标图片,并在本地预设图片存储空间内保存所述目标图片,以在当前时刻之后接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若获取所述目标图片失败,生成所述目标图片的加载缓存信息,并将所述加载缓存信息存入预设加载信息缓存空间,所述加载缓存信息包括所述目标图片所对应的关键字以及所述目标图片的加载地址。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    每隔预设时间间隔,基于所述目标图片对应的关键字从所述预设加载信息缓存空间中读取所述加载缓存信息,并根据所述加载地址执行从远程获取所述目标图片的操作;
    若获取到所述目标图片,将所述目标图片保存在预设图片存储空间,以在接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
  4. 根据权利要求1或3所述的方法,其特征在于,所述方法还包括:
    生成所述目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对所述压缩图片的浏览请求时,展示所述压缩图片。
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:
    将所述压缩图片与预设展示所述压缩图片的页面数据进行关联。
  6. 根据权利要求4所述的方法,其特征在于,所述压缩图片包括第一压缩图片和第二压缩图片,所述第一压缩图片的大小大于所述第二压缩图片的大小;其中,所述第一压缩图片供用户预览所述目标图片的信息,所述第二压缩图片供用户在缩略图中浏览所述目标图片的信息。
  7. 一种用于加载页面图片的装置,其特征在于,包括:
    图片信息获取单元,配置用于响应于接收到页面中的目标图片的加载指令,获取所述目标图片的图片信息,所述图片信息包括图片类型与图片加载地址;
    确定单元,配置用于确定本地是否存储有所述目标图片;
    图片获取单元,配置用于响应于确定本地无存储所述目标图片,基于所述图片加载地址从远程获取所述目标图片;
    展示单元,配置用于在所述页面中展示所述目标图片,并在本地预设图片存储空间内保存所述目标图片,以在当前时刻之后接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括缓存单元,所述缓存单元配置用于:
    响应于所述目标图片获取失败,生成所述目标图片的加载缓存信息,并将所述加载缓存信息存入预设加载信息缓存空间,所述加载缓存信息包括所述目标图片所对应的关键字以及所述目标图片的加载地址。
  9. 根据权利要求8所述的装置,其特征在于,所述图片获取单元进一步配置用于:
    每隔预设时间间隔,基于所述目标图片对应的关键字从所述预设 加载信息缓存空间中读取所述加载缓存信息,并根据所述加载地址执行从远程获取所述目标图片的操作;
    若获取到所述目标图片,将所述目标图片保存在预设图片存储空间,以在接收到用户对所述目标图片的浏览请求时,展示所述目标图片。
  10. 根据权利要求7或9所述的装置,其特征在于,所述装置还包括压缩单元,所述压缩单元配置用于:
    生成所述目标图片的按照预设比例缩小的压缩图片并保存,以在接收到用户对所述压缩图片的浏览请求时,展示所述压缩图片。
  11. 根据权利要求10所述的方法,其特征在于,所述装置还包括关联单元,所述关联单元配置用于:
    将所述压缩图片与预设展示所述压缩图片的页面数据进行关联。
  12. 根据权利要求10所述的方法,其特征在于,所述压缩图片包括第一压缩图片和第二压缩图片,所述第一压缩图片的大小大于所述第二压缩图片;其中,所述第一压缩图片供用户预览所述目标图片的信息,所述第二压缩图片供用户在缩略图中浏览所述目标图片的信息。
  13. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    存储装置,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-6中任一所述的方法。
  14. 一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现如权利要求1-6中任一所述的方法。
PCT/CN2020/074438 2019-04-03 2020-02-06 用于加载页面图片的方法、装置和电子设备 WO2020199751A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910267547.0A CN110096660B (zh) 2019-04-03 2019-04-03 用于加载页面图片的方法、装置和电子设备
CN201910267547.0 2019-04-03

Publications (1)

Publication Number Publication Date
WO2020199751A1 true WO2020199751A1 (zh) 2020-10-08

Family

ID=67444258

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/074438 WO2020199751A1 (zh) 2019-04-03 2020-02-06 用于加载页面图片的方法、装置和电子设备

Country Status (2)

Country Link
CN (1) CN110096660B (zh)
WO (1) WO2020199751A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112752107A (zh) * 2020-12-26 2021-05-04 广东工业大学 网页图片预处理方法、系统、存储介质及计算机设备

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096660B (zh) * 2019-04-03 2022-02-11 北京字节跳动网络技术有限公司 用于加载页面图片的方法、装置和电子设备
CN112948728A (zh) * 2019-11-26 2021-06-11 北京沃东天骏信息技术有限公司 一种浏览图片的方法和装置
CN110929197A (zh) * 2019-11-27 2020-03-27 杭州安恒信息技术股份有限公司 一种网页图片的预览加载方法和装置
CN110990611B (zh) * 2019-12-03 2023-04-21 北京奇艺世纪科技有限公司 图片缓存方法、装置、电子设备及存储介质
CN111625308B (zh) * 2020-04-28 2022-02-11 北京字节跳动网络技术有限公司 一种信息展示方法、装置和电子设备
CN112417339A (zh) * 2020-12-02 2021-02-26 北京齐尔布莱特科技有限公司 一种页面加载方法、装置、计算设备及可读存储介质
CN112615911B (zh) * 2020-12-10 2023-06-16 北京五八信息技术有限公司 图片加载方法、图片加载装置及电子设备
CN113033173A (zh) * 2021-04-26 2021-06-25 广州文石信息科技有限公司 一种流式文档图片加载方法、装置、电子设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914495A (zh) * 2013-01-09 2014-07-09 阿里巴巴集团控股有限公司 一种页面预览方法及系统
US20140310372A1 (en) * 2013-04-12 2014-10-16 Tencent Technology (Shenzhen) Company Limited Method, terminal, cache server and system for updating webpage data
CN104253836A (zh) * 2013-06-27 2014-12-31 腾讯科技(深圳)有限公司 基于无线网络的图片显示方法、移动终端和系统
CN108769195A (zh) * 2018-05-29 2018-11-06 北京搜狐新动力信息技术有限公司 一种媒体数据的处理方法及装置
CN110096660A (zh) * 2019-04-03 2019-08-06 北京字节跳动网络技术有限公司 用于加载页面图片的方法、装置和电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914495A (zh) * 2013-01-09 2014-07-09 阿里巴巴集团控股有限公司 一种页面预览方法及系统
US20140310372A1 (en) * 2013-04-12 2014-10-16 Tencent Technology (Shenzhen) Company Limited Method, terminal, cache server and system for updating webpage data
CN104253836A (zh) * 2013-06-27 2014-12-31 腾讯科技(深圳)有限公司 基于无线网络的图片显示方法、移动终端和系统
CN108769195A (zh) * 2018-05-29 2018-11-06 北京搜狐新动力信息技术有限公司 一种媒体数据的处理方法及装置
CN110096660A (zh) * 2019-04-03 2019-08-06 北京字节跳动网络技术有限公司 用于加载页面图片的方法、装置和电子设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112752107A (zh) * 2020-12-26 2021-05-04 广东工业大学 网页图片预处理方法、系统、存储介质及计算机设备
CN112752107B (zh) * 2020-12-26 2023-02-10 广东工业大学 网页图片预处理方法、系统、存储介质及计算机设备

Also Published As

Publication number Publication date
CN110096660B (zh) 2022-02-11
CN110096660A (zh) 2019-08-06

Similar Documents

Publication Publication Date Title
WO2020199751A1 (zh) 用于加载页面图片的方法、装置和电子设备
US10182127B2 (en) Application-driven CDN pre-caching
RU2689439C2 (ru) Улучшение производительности веб-доступа
CN112559927B (zh) 一种网页加载方法及装置
JP6328233B2 (ja) ウェブ・ページのロードを最適化するためのコンピュータ・プログラム製品、システム、および方法
CN109992406B (zh) 图片请求方法、响应图片请求的方法及客户端
JP2013122768A (ja) 通信デバイスにおけるコンテンツの検索/ダウンロードのための装置および方法
CN107040584B (zh) 客户端下载图片的方法及装置
JP2015509229A5 (zh)
KR20090125108A (ko) 사용자 정황 기반으로 콘텐츠를 프리로딩하기 위한 시스템 및 방법
US10496696B2 (en) Search method and apparatus
CN108334516B (zh) 信息推送方法和装置
US11032683B2 (en) Method and apparatus for publishing cloud resource
CN111756847B (zh) 网站支持https协议的方法和装置
CN104601534A (zh) Cdn系统图像处理的方法及系统
CN112269959A (zh) 展示内容的控制方法、装置、可读介质和电子设备
CN112183045A (zh) 在线文档处理方法、装置和电子设备
CN106354792B (zh) 网页显示方法及装置
CN108255898B (zh) 页面显示方法和装置
US10021207B1 (en) Architecture for proactively providing bundled content items to client devices
CN106649792B (zh) 一种页面访问方法及装置
CN111988405B (zh) 负载均衡装置的报文重写方法及负载均衡装置
US11379653B2 (en) Rendering method for on-demand loading of PDF file on network
US10880396B2 (en) Pre-fetching random-value resource locators
KR20120016335A (ko) 오프라인 실행을 위한 웹 페이지 사전 캐싱 시스템 및 방법

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20784599

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 04/02/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20784599

Country of ref document: EP

Kind code of ref document: A1