File generation method, device, equipment and storage medium
By obtaining and processing the target image attribute information required for web page development, and generating target path files, the problem of high labor cost and low efficiency of CSS file image processing in web page development in the existing technology is solved, and the path files are automatically generated, which improves the Development efficiency and reduce costs.
Patent Information
- Application Number
- CN202111578029.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the development of existing web pages, the processing of image classes in CSS files requires manual input, resulting in high labor costs and low efficiency.
By obtaining the attribute information of the target image, a target path file is generated for the development of the web page, and a picture preview page is generated based on the file, and a path file is automatically generated for the web page development, reducing manual operations.
Improves web development efficiency, reduces labor costs, and automated processing reduces manual operation steps.
Smart Images

Figure CN114489639B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of web page processing, and in particular to a file generation method, equipment, device and storage medium. Background Art
[0002] In the process of opening a web page, the browser contains a rendering engine for rendering the content displayed in the window. The rendering engine of the browser renders HTML (HyperText Markup Language) according to the CSS (Cascading Style Sheets) file to generate the web page to be opened.
[0003] Currently, the image class of the CSS file needs to be manually written by developers, which results in a large manpower cost for web page development and reduces the efficiency of web page development. Summary of the invention
[0004] The present disclosure provides a file generation method, device, apparatus and storage medium to at least solve the problem of high cost and low efficiency of existing web page development. The technical solution of the present disclosure is as follows:
[0005] The present disclosure provides a method for generating a file, including:
[0006] Get the target images needed to develop web pages;
[0007] Perform image processing on the target image to obtain attribute information of the target image;
[0008] Generate a target path file required for developing a web page according to the attribute information of the target image;
[0009] Based on the target path file, a picture preview page is generated, wherein the picture preview page displays attribute information of the target picture.
[0010] Optionally, obtaining a target image required for developing a webpage includes:
[0011] In response to the path information input operation, obtaining the image resource path;
[0012] The target image required for developing the web page is screened out from the resource library corresponding to the image resource path.
[0013] Optionally, in response to the path information input operation, obtaining the image resource path includes:
[0014] Displaying a command line tool interface, wherein the command line tool interface includes information input items;
[0015] In response to the operation of inputting the image resource path in the information input item, the image resource path is acquired.
[0016] Optionally, the step of selecting a target image required for developing the webpage from a resource library corresponding to the image resource path includes:
[0017] According to a preset picture resolution and / or a preset picture format, a target picture that meets a preset picture attribute condition is screened out from a resource library corresponding to the picture resource path.
[0018] Optionally, the attribute information of the target image includes a name of the image, and the performing image processing on the target image to obtain the attribute information of the target image includes:
[0019] According to a preset naming rule, the picture name of the target picture is corrected to obtain a corrected picture name of the target picture; and
[0020] Analyze the information of the target image to obtain the image height, image width and location path of the target image;
[0021] According to the location path of the target image, an introduction path of the target image is generated.
[0022] Optionally, the correcting the picture name of the target picture according to a preset naming rule to obtain the corrected picture name of the target picture includes at least one of the following correction methods:
[0023] Recognize the target setting characters contained in the picture name of the target picture, and remove the recognized target setting characters from the picture name of the target picture;
[0024] Identify the Chinese text segment contained in the picture name of the target picture, and replace the identified Chinese text segment with an English text segment corresponding to the Chinese text segment;
[0025] Identify the uppercase letters contained in the picture name of the target picture, and replace the identified uppercase letters with lowercase letters.
[0026] Optionally, generating an import path of the target image according to the location path of the target image includes:
[0027] Obtain the location path of the target path file;
[0028] Determine the target directory level corresponding to the target image according to the location path of the target path file;
[0029] The image import path of the target image is generated according to the target directory level corresponding to the target image and the location path of the target image.
[0030] Optionally, the attribute information of the target image includes an image name, an image height, an image width, and an image import path, and generating a target path file required for developing a web page according to the attribute information of the target image includes:
[0031] The image name, image height, image width and image import path of the target image are written into a file in a set arrangement order to generate the target path file.
[0032] Optionally, generating a picture preview page based on the target path file includes:
[0033] The target path file is used to render the hypertext markup language file to generate the image preview page.
[0034] The present disclosure also provides a file generation device, including:
[0035] The acquisition module is used to obtain the target image required for developing web pages;
[0036] An image processing module is used to process the target image to obtain attribute information of the target image;
[0037] A file generation module, used to generate a target path file required for developing a web page according to the attribute information of the target image;
[0038] The page generation module is used to generate a picture preview page based on the target path file, wherein the picture preview page displays the attribute information of the target picture.
[0039] Optionally, when acquiring the target image required for developing a web page, the acquisition module is used to obtain an image resource path in response to a path information input operation; and filter out the target image required for developing the web page from a resource library corresponding to the image resource path.
[0040] Optionally, when the acquisition module obtains the image resource path in response to a path information input operation, it is used to display a command line tool interface, and the command line tool interface includes an information input item; in response to the operation of inputting the image resource path in the information input item, the image resource path is obtained.
[0041] Optionally, when the acquisition module filters out the target image required for developing the web page from the resource library corresponding to the image resource path, it is used to filter out the target image that meets the preset image attribute conditions from the resource library corresponding to the image resource path according to the preset image resolution and / or preset image format.
[0042] Optionally, the image processing module includes a correction submodule, a parsing submodule and a generation submodule;
[0043] a correction submodule, used to correct the picture name of the target picture according to a preset naming rule to obtain a corrected picture name of the target picture; and
[0044] The parsing submodule is used to parse the information of the target image to obtain the image height, image width and location path of the target image;
[0045] The generation submodule is used to generate an import path of the target image according to the location path of the target image.
[0046] Optionally, the correction submodule, when correcting the picture name of the target picture according to a preset naming rule to obtain the corrected picture name of the target picture, includes at least one of the following correction methods:
[0047] Recognize the target setting characters contained in the picture name of the target picture, and remove the recognized target setting characters from the picture name of the target picture;
[0048] Identify the Chinese text segment contained in the picture name of the target picture, and replace the identified Chinese text segment with an English text segment corresponding to the Chinese text segment;
[0049] Identify the uppercase letters contained in the picture name of the target picture, and replace the identified uppercase letters with lowercase letters.
[0050] Optionally, when generating the import path of the target image according to the location path of the target image, the generation submodule is used to obtain the location path of the target path file; determine the target directory level corresponding to the target image according to the location path of the target path file; and generate the image import path of the target image according to the target directory level corresponding to the target image and the location path of the target image.
[0051] Optionally, the attribute information of the target image includes image name, image height, image width and image import path. When the file generation module generates the target path file required for developing a web page based on the attribute information of the target image, the file generation module is used to write the image name, image height, image width and image import path of the target image into the file in a set arrangement order to generate the target path file.
[0052] Optionally, when generating the image preview page based on the target path file, the file generation module is used to render a hypertext markup language file using the target path file to generate the image preview page.
[0053] The present disclosure also provides an electronic device, including:
[0054] processor;
[0055] a memory for storing instructions executable by the processor;
[0056] The processor is configured to execute the instructions to implement each step in the above method.
[0057] The embodiment of the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute each step in the above method.
[0058] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0059] In some embodiments of the present disclosure, a file generating device obtains a target image required for developing a web page, performs image processing on the target image, and obtains attribute information of the target image; the file generating device generates a target path file required for developing a web page based on the attribute information of the target image; the file generating device generates an image preview page based on the target path file; the file generating device can automatically generate the target path file required for developing a web page, without the need for manual creation of the target path file, thereby improving the efficiency of web page development and reducing the labor cost of web page development.
[0060] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0062] Figure 1A flowchart of a file generation method provided for an exemplary embodiment of the present disclosure;
[0063] Figure 2 A flowchart of another file generation method provided for an exemplary embodiment of the present disclosure;
[0064] Figure 3 A flowchart of another file generation method provided for an exemplary embodiment of the present disclosure;
[0065] Figure 4 A flowchart of another file generation method provided for an exemplary embodiment of the present disclosure;
[0066] Figure 5 A flowchart of another file generation method provided for an exemplary embodiment of the present disclosure;
[0067] Figure 6a A structural block diagram of a file generating device provided for an exemplary embodiment of the present disclosure;
[0068] Figure 6b A structural block diagram of another file generating device provided for an exemplary embodiment of the present disclosure;
[0069] Figure 7 A schematic block diagram of an example electronic device that can be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0070] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0072] In the process of opening a web page, the browser contains a rendering engine for rendering the content displayed in the window. The rendering engine of the browser renders html (HyperText Markup Language) according to the CSS (Cascading Style Sheets) file to generate the web page to be opened.
[0073] During the web page development stage, developers need to manually write the image classes required by the CSS file to generate the CSS file. Nowadays, web pages contain more images, so a large manpower cost is consumed, which in turn affects the efficiency of web page development.
[0074] In response to the above-mentioned technical problems, in some embodiments of the present disclosure, a file generating device obtains a target image required for developing a web page, performs image processing on the target image, and obtains attribute information of the target image; the file generating device generates a target path file required for developing a web page according to the attribute information of the target image; the file generating device generates an image preview page based on the target path file; the file generating device can automatically generate the target path file required for developing a web page, without the need for manual creation of the target path file, thereby improving the efficiency of web page development and reducing the labor cost of web page development.
[0075] The technical solutions provided by various embodiments of the present disclosure are described in detail below in conjunction with the accompanying drawings.
[0076] Figure 1 The following is a flowchart of a method for generating a file provided by an exemplary embodiment of the present disclosure. Figure 1 As shown, the method includes:
[0077] S101: Obtain a target image required for developing a web page;
[0078] S102: performing image processing on the target image to obtain attribute information of the target image;
[0079] S103: Generate a target path file required for developing a web page according to the attribute information of the target image;
[0080] S104: Generate a picture preview page based on the target path file, wherein the picture preview page displays attribute information of the target picture.
[0081] In this embodiment, the execution subject of the above method is a file generating device, and the file generating device may be a smart terminal or a server.
[0082] When the file generating device is a smart terminal, the smart terminal includes but is not limited to any of the following: a personal computer, a tablet computer, a laptop computer, a mobile phone, a smart bracelet, a smart TV, a smart watch, and a smart speaker.
[0083] When the file generating device is a server, this embodiment does not limit the implementation form of the server, and the server can be a conventional server, a cloud server, a cloud host, a virtual center, etc. Among them, the composition of the server device mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0084] It should be noted that HTML (Hyper Text Markup Language) is a markup language. It includes a series of tags, through which the document format on the Internet can be unified, so that scattered network resources can be connected into a logical whole. HTML text is a descriptive text composed of HTML commands, which can describe text, graphics, animations, sounds, tables and links. HTML markup symbols are used to mark the contents of the web page to be displayed, and the web page file itself is a text file. By adding tags to the text file, the browser can display the contents of the web page file according to the tags, such as: how to process text, how to arrange the picture, how to display the picture, etc.; the browser reads the web page file in sequence, interprets and displays the marked content according to the tags.
[0085] CSS (Cascading Style Sheets) is a computer programming language used to define how to display elements in HTML (Hypertext Markup Language) to achieve static or dynamic layout of web pages. CSS can control the position and layout format of elements in a web page and supports various font styles.
[0086] CSS files, hereinafter referred to as Cascading Style Sheet files, are text files used to generate web pages. When opening a web page, the browser's rendering engine renders HTML based on the CSS file to generate the web page to be opened.
[0087] Less files are files generated based on the Less language. Less is a CSS preprocessing language that extends the CSS language and adds features such as variables and functions. Less files can run on Node or browsers. Less files are visible to web page production technicians. From the Less file, you can get the synthesis information corresponding to each sub-image and the storage path of each sub-image. The code of the Less file is compiled into the code of the CSS file; and when a page is loaded or the command line tool is used, the Less file can also be compiled into JavaScript in the browser.
[0088] An embodiment of web page rendering is that the terminal responds to the user's URL input operation and obtains the input URL; the browser installed on the terminal sends a request to the server. After the server receives the request from the terminal, the server sends the HTML and CSS files to the terminal, and the browser installed on the terminal starts to render HTML according to the CSS files; wherein, the order in which the browser renders the web page can be from top to bottom. In the process of browser rendering web pages, the browser first parses HTML and constructs an internal file tree to represent all displayed elements. Then, the browser specifies various matching styles for the elements according to the standard CSS cascading, inheritance and sorting rules, and generates a rendering tree. After the rendering tree is generated, the browser will "draw" all the nodes in the rendering tree on the screen, thereby generating the entire page corresponding to the URL.
[0089] In this embodiment, the file generating device obtains a target image required for developing a web page; the file generating device performs image processing on the target image to obtain attribute information of the target image; the file generating device generates a target path file required for developing a web page based on the attribute information of the target image; and generates an image preview page based on the target path file, wherein the image preview page displays the attribute information of the target image.
[0090] In the above embodiment, the file generation device obtains the target image required for developing the web page. One achievable method is to obtain the image resource path in response to the path information input operation; and filter out the target image required for developing the web page from the resource library corresponding to the image resource path.
[0091] It should be noted that the product forms corresponding to the products executing the above methods include but are not limited to the following: command line tools, applications and plug-ins.
[0092] For example, the file generation device responds to the command line tool opening operation and displays the command line tool interface, wherein the command line tool interface includes a command input line; the file generation device responds to the user inputting the image resource path in the command input line and obtains the image resource path of the image required for developing the web page; the file generation device filters out the target image from the resource library corresponding to the image resource path according to the preset image filtering rules; the file generation device generates the target path file required for developing the web page according to the attribute information of the target image and the preset file generation rules.
[0093] For another example, the file generation device displays an application interface in response to an application opening operation, wherein the application interface includes a path input drop-down menu item; the file generation device selects a picture resource path of a picture required for developing a web page in response to a user's selection operation through the path input drop-down menu item; the file generation device filters out a target picture from a resource library corresponding to the picture resource path according to a preset picture filtering rule; the file generation device generates a target path file required for developing a web page according to attribute information of the target picture and preset file generation rules.
[0094] In the above embodiment, the file generation device obtains the image resource path of the image required for developing the web page in response to the path information input operation, including but not limited to the following path acquisition methods:
[0095] In the first path acquisition method, the file generation device displays a command line tool interface, which includes an information input item; the file generation device responds to the operation of inputting the image resource path in the information input item to obtain the image resource path.
[0096] In the second path acquisition method, the file generation device displays an application interface, wherein the application interface includes a path input drop-down menu item; the file generation device responds to the user's selection operation through the path input drop-down menu item and selects the image resource path of the image required for developing the web page.
[0097] In the third path acquisition method, the file generation device displays an application interface, wherein the application interface includes a command line tool opening control; the file generation device responds to a trigger operation on the command line tool opening control by displaying a command line tool interface, wherein the command line tool interface includes an information input item; the file generation device responds to an operation of inputting an image resource path in the information input item to obtain the image resource path.
[0098] It should be noted that the user triggering methods of the control include but are not limited to at least one of the following: single click, double click, pull down, pull up and hover.
[0099] In the above-mentioned path acquisition method 1, for example, the file generation device responds to the command line tool opening operation and displays the command line tool interface, wherein the command line tool interface includes a command input line; the file generation device responds to the user inputting the image resource path in the command input line and obtains the image resource path of the image required for developing the web page.
[0100] In the above-mentioned path acquisition method 2, for example, the file generation device responds to the application opening operation and displays the application interface, wherein the application interface includes a path input drop-down menu item; the file generation device responds to the user's selection operation through the path input drop-down menu item and selects the image resource path of the image required for developing the web page.
[0101] In the above-mentioned path acquisition method three, for example, the file generation device responds to the application opening operation to display the application interface, wherein the application interface includes a command line tool opening control; the file generation device responds to the triggering operation of the command line tool opening control to display the command line tool interface, wherein the command line tool interface includes a command input line, and the file generation device responds to the user inputting the image resource path in the command input line to obtain the image resource path of the image required for developing the web page.
[0102] In the above embodiment, the resource types stored in the resource library corresponding to the image resource path include but are not limited to at least one of the following: images, voices, videos and files. Therefore, after the file generation device queries the corresponding resource library according to the image resource path, it is necessary to filter out the target images required for developing the web page from the resource library. The file generation device filters out the target images from the resource library corresponding to the image resource path according to the preset image filtering rules. One achievable method is that the file generation device filters out the target images whose image attributes meet the preset image attribute conditions from the resource library corresponding to the image resource path. The file generation device quickly filters out the required target images from the resource library according to the image attributes, thereby improving the query efficiency of the images.
[0103] It should be noted that the attribute information of the picture includes but is not limited to the following: picture name, picture height, picture width, picture size, picture import path, picture format and picture resolution. The preset picture attribute condition may be a preset picture format, a preset picture resolution and a preset picture size. The present disclosure embodiment does not limit the preset picture attribute condition, and the preset picture attribute condition may be adjusted according to actual conditions.
[0104] The file generation device selects target images that meet preset image attribute conditions from the resource library corresponding to the image resource path according to the preset image resolution and / or preset image format, including but not limited to the following screening methods:
[0105] Filtering method 1: Filter target images with preset image formats from the resource library corresponding to the image resource path. The image formats include but are not limited to the following: bmp, jpg, png, tif, gif, pcx, tga, exif, fpx, svg, psd, cdr, pcd, dxf, ufo, eps, ai, raw, WMF, webp, avif and apng.
[0106] Screening method 2: Screen out images whose resolution is greater than a set resolution threshold from the resource library corresponding to the image resource path. The present disclosure embodiment does not limit the set resolution threshold, and the set resolution threshold can be adjusted according to actual conditions. The image formats include but are not limited to the following: 320*240, 640*480, 1024*768 and 1280*1024.
[0107] Screening method three: Screen out images whose image format is a preset image format and whose image resolution is greater than a set resolution threshold from the resource library corresponding to the image resource path.
[0108] In the above-mentioned screening method 1, for example, pictures in the formats of jpg, png and gif are screened out from the resource library corresponding to the picture resource path as target pictures.
[0109] In the above-mentioned second screening method, for example, pictures with a resolution greater than 320*240 are screened out from the resource library corresponding to the picture resource path as target pictures.
[0110] In the above screening method three, pictures with the following formats: jpg, png and gif and a resolution greater than 320*240 are screened out from the resource library corresponding to the picture resource path as target pictures.
[0111] The image names of images required for developing web pages need to meet certain specifications. When users name images in a resource library, the image names may not meet the requirements of developing web pages. Manually modifying image names takes a lot of time, affects web page development efficiency, and increases labor costs. Therefore, the present disclosure provides a method for automatically correcting image names.
[0112] In the above embodiment, the file generation device processes the target image to obtain the attribute information of the target image. One achievable method is to correct the image name of the target image according to a preset naming rule to obtain the corrected image name of the target image; and perform information analysis on the target image to obtain the image height, image width and location path of the target image; and generate the import path of the target image according to the location path of the target image.
[0113] In an optional embodiment, the file generation device corrects the image name of the target image according to a preset naming rule to obtain a corrected image name of the target image, including but not limited to at least one of the following correction methods:
[0114] Correction method 1: The file generation device identifies the target setting characters included in the picture name of the target picture, and removes the identified target setting characters from the picture name of the target picture. Among them, the target setting characters include, but are not limited to, the following: text, numbers, and special characters. Among them, special characters, for example, phonetic symbols, mathematical symbols, pinyin characters, graphic symbols, square symbols, and arrows.
[0115] Correction method 2: The file generation device identifies the Chinese text segment included in the picture name of the target picture, and replaces the identified Chinese text segment with the corresponding English text segment.
[0116] Correction method 3: The file generation device identifies the capital letters included in the picture name of the target picture, and replaces the identified capital letters with lowercase letters.
[0117] In the above correction method 1, for example, the file generation device identifies the space included in the picture name of the target picture, and removes the identified space from the picture name of the target picture.
[0118] In the above correction method 2, for example, the file generation device identifies the Chinese text segment "flower" included in the picture name of the target picture, and replaces the identified Chinese text segment with the corresponding English text segment "huaduo".
[0119] In the above correction method 3, for example, the file generation device identifies the capital letters "A", "B", and "C", etc. included in the picture name of the target picture, and replaces the identified capital letters "A", "B", and "C" with lowercase letters "a", "b", and "c".
[0120] After the file generation device filters out the target picture from the resource library corresponding to the picture resource path, it also needs to obtain the picture import path of the target picture. One achievable way is that the file generation device obtains the location path of the target picture and the location path of the target path file; the file generation device determines the target directory level corresponding to the target picture according to the location path of the target path file; the file generation device generates the picture import path of the target picture according to the target directory level corresponding to the target picture and the location path of the target picture. Among them, the location path of the target picture and the location path of the target path file are absolute paths. For example, the location path of the first picture in the target picture is E:\Learning files\ps pictures\1.img. The picture import path is a relative path. For example, when the target picture is in the upper-upper directory level of the target path file, the picture import path of the first picture in the target picture is.. / .. / E: / Learning files ps pictures / 1.img, where. / represents the current path,.. / represents the upper level of the current path, and.. / .. / represents the upper-upper level of the current path.
[0121] For example, the file generating device obtains the location path of the target image E:\learning file\ps image\1.img and the location path of the target path file C:\development file\20.less. The file generating device determines that the target directory level corresponding to the target image is the upper-level target level according to the location path of the target path file. According to the target directory level corresponding to the target image and the location path of the target image, the image import path of the target image is generated as .. / .. / E: / learning file ps image / 1.img.
[0122] After acquiring the attribute information of the target image, the file generation device writes the image name, image height, image width and image import path of the target image into the file according to the set arrangement order to generate the target path file. It should be noted that the above-mentioned file generation rule can be a generation rule of a Less file to generate a target Less file; or, the above-mentioned file generation rule can also be a generation rule of a cascading style sheet file to generate a target cascading style sheet file.
[0123] After the file generation device generates the target path file, the target image is displayed to the user so that the user can view the information of the target image. One achievable method is that the file generation device renders a hypertext markup language file using the target path file to generate an image preview page; and displays the image preview page. Among them, the user can view the image name, image height, image width and image size of the target image through the image preview page, thereby improving the user experience.
[0124] The image resources in the resource library need to be maintained later. When the image resources in the resource library change, the above file generation method can be re-executed to generate a new target path file without manual update, which reduces labor costs and improves web development efficiency.
[0125] In one embodiment, when the target path file is a target cascading style sheet file, the rendering engine of the browser renders HTML according to the target cascading style sheet file to generate a web page to be opened.
[0126] In another embodiment, when the target path file is a target Less file, the target Less file is compiled to obtain a target cascading style sheet file, and the rendering engine of the browser renders HTML according to the target cascading style sheet file to generate a web page to be opened.
[0127] Combined with the description of the above embodiments, Figure 2 FIG. 1 is a flow chart of another file generation method provided by an exemplary embodiment of the present disclosure. Figure 2 As shown, the method includes:
[0128] S201: In response to the path information input operation, obtaining the image resource path of the image required for developing the web page;
[0129] S202: Filtering target images from a resource library corresponding to the image resource path according to a preset image filtering rule;
[0130] S203: Generate a target path file required for developing a web page according to the attribute information of the target image and a preset file generation rule;
[0131] S204: In response to the file compiling operation, compile the target path file to generate a cascading style sheet file required for developing a web page.
[0132] In this embodiment, the implementation methods of each step of the above-mentioned file generation method of this embodiment can refer to the description of the corresponding parts of the aforementioned embodiments. This embodiment can also achieve the corresponding technical effects of the aforementioned embodiments, which will not be repeated in this embodiment.
[0133] Combined with the description of the above embodiments, Figure 3 FIG. 1 is a flow chart of another file generation method provided by an exemplary embodiment of the present disclosure. Figure 3 As shown, the method includes:
[0134] S301: In response to the path information input operation, obtaining the image resource path of the image required for developing the web page;
[0135] S302: Filtering target images from a resource library corresponding to the image resource path according to a preset image filtering rule;
[0136] S303: Generate a target path file required for developing a web page according to the attribute information of the target image and a preset file generation rule;
[0137] S304: In response to the file compiling operation, compile the target path file to generate a cascading style sheet file required for developing a web page;
[0138] S305: Rendering hypertext markup language using the cascading style sheet file to generate a target web page.
[0139] In this embodiment, the implementation methods of each step of the above-mentioned file generation method of this embodiment can refer to the description of the corresponding parts of the aforementioned embodiments. This embodiment can also achieve the corresponding technical effects of the aforementioned embodiments, which will not be repeated in this embodiment.
[0140] Combined with the description of the above embodiments, Figure 4 FIG. 1 is a flow chart of another file generation method provided by an exemplary embodiment of the present disclosure. Figure 4 As shown, the method includes:
[0141] S401: In response to the path information input operation, obtaining the image resource path of the image required for developing the web page;
[0142] S402: Filtering target images from a resource library corresponding to the image resource path according to a preset image filtering rule;
[0143] S403: Generate a target path file required for developing a web page according to the attribute information of the target image and a preset file generation rule;
[0144] S404: Generate a picture preview page based on the target path file;
[0145] S405: Displaying the image preview page.
[0146] In this embodiment, the implementation methods of each step of the above-mentioned file generation method of this embodiment can refer to the description of the corresponding parts of the aforementioned embodiments. This embodiment can also achieve the corresponding technical effects of the aforementioned embodiments, which will not be repeated in this embodiment.
[0147] Combined with the description of the above embodiments, Figure 5 FIG. 1 is a flow chart of another file generation method provided by an exemplary embodiment of the present disclosure. Figure 5 As shown, the method includes:
[0148] S501: Displaying a command line tool interface, where the command line tool interface includes information input items;
[0149] S502: In response to the operation of inputting a picture resource path in the information input item, the picture resource path is obtained;
[0150] S503: Filtering target images from a resource library corresponding to the image resource path according to a preset image filtering rule;
[0151] S504: Generate a target path file required for developing a web page according to the attribute information of the target image and a preset file generation rule.
[0152] In this embodiment, the implementation methods of each step of the above-mentioned file generation method of this embodiment can refer to the description of the corresponding parts of the aforementioned embodiments. This embodiment can also achieve the corresponding technical effects of the aforementioned embodiments, which will not be repeated in this embodiment.
[0153] In the above-mentioned method embodiments of the present disclosure, the file generating device obtains the target image required for developing the web page, performs image processing on the target image, and obtains the attribute information of the target image; the file generating device generates the target path file required for developing the web page according to the attribute information of the target image; the file generating device generates the image preview page based on the target path file; the file generating device can automatically generate the target path file required for developing the web page, without the need for manual creation of the target path file, thereby improving the efficiency of web page development and reducing the labor cost of web page development.
[0154] Figure 6a FIG. 6 is a structural block diagram of a file generating device 60 provided by an exemplary embodiment of the present disclosure. Figure 6a As shown, the file generating device 60 includes: an acquisition module 61 , a picture processing module 62 , a file generating module 63 and a page generating module 64 .
[0155] Wherein, the acquisition module 61 is used to acquire the target image required for developing the web page;
[0156] The image processing module 62 is used to process the target image to obtain the attribute information of the target image;
[0157] A file generation module 63, used to generate a target path file required for developing a web page according to the attribute information of the target image;
[0158] The page generation module 64 is used to generate a picture preview page based on the target path file, wherein the picture preview page displays attribute information of the target picture.
[0159] Optionally, when acquiring the target image required for developing a web page, the acquisition module 61 is used to respond to the path information input operation to acquire the image resource path; and filter out the target image required for developing the web page from the resource library corresponding to the image resource path.
[0160] Optionally, when the acquisition module 61 acquires the image resource path in response to the path information input operation, it is used to display the command line tool interface, the command line tool interface includes an information input item; in response to the operation of inputting the image resource path in the information input item, the image resource path is acquired.
[0161] Optionally, when the acquisition module 61 filters out the target images required for developing a web page from the resource library corresponding to the image resource path, it is used to filter out the target images that meet the preset image attribute conditions from the resource library corresponding to the image resource path according to the preset image resolution and / or preset image format.
[0162] Optionally, Figure 6b A structural block diagram of another file generating device provided by an exemplary embodiment of the present disclosure, such as Figure 6bAs shown, the image processing module 62 includes a correction submodule 621, a parsing submodule 622 and a generation submodule 623;
[0163] The correction submodule 621 is used to correct the image name of the target image according to a preset naming rule to obtain a corrected image name of the target image; and
[0164] The parsing submodule 622 is used to parse the target image information to obtain the image height, image width and location path of the target image;
[0165] The generating submodule 623 is used to generate an import path of the target image according to the location path of the target image.
[0166] Optionally, the correction submodule 621, when correcting the image name of the target image according to a preset naming rule to obtain the corrected image name of the target image, includes at least one of the following correction methods:
[0167] Recognize the target setting characters included in the picture name of the target picture, and remove the recognized target setting characters from the picture name of the target picture;
[0168] Recognize the Chinese text segment contained in the image name of the target image, and replace the recognized Chinese text segment with an English text segment corresponding to the Chinese text segment;
[0169] Identify the uppercase letters contained in the image name of the target image, and replace the identified uppercase letters with lowercase letters.
[0170] Optionally, when generating the import path of the target image according to the location path of the target image, the generation submodule 623 is used to obtain the location path of the target path file; determine the target directory level corresponding to the target image according to the location path of the target path file; and generate the image import path of the target image according to the target directory level corresponding to the target image and the location path of the target image.
[0171] Optionally, the attribute information of the target image includes image name, image height, image width and image import path. When the file generation module 63 generates the target path file required for developing a web page based on the attribute information of the target image, the file generation module 63 is used to write the image name, image height, image width and image import path of the target image into the file in a set arrangement order to generate a target path file.
[0172] Optionally, when generating the picture preview page based on the target path file, the file generating module 63 is used to render the hypertext markup language file using the target path file to generate the picture preview page.
[0173] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0174] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0175] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 707 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0176] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 707, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 707, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0177] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a text processing method. For example, in some embodiments, the text processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 707. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the text processing method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the text processing method in any other appropriate manner (e.g., by means of firmware).
[0178] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0179] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0180] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0181] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0182] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0183] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0184] Accordingly, the present disclosure also provides a computer-readable storage medium storing a computer program. When the computer-readable storage medium stores the computer program and the computer program is executed by one or more processors, the one or more processors execute Figure 1 Each step in the method embodiment.
[0185] Accordingly, the present disclosure also provides a computer program product, the computer program product includes a computer program / instruction, the computer program / instruction is executed by a processor Figure 1 Each step in the method embodiment.
[0186] In the above-mentioned apparatuses, devices, storage media and computer program product embodiments of the present disclosure, the file generating device obtains the target image required for developing a web page, performs image processing on the target image, and obtains attribute information of the target image; the file generating device generates a target path file required for developing a web page according to the attribute information of the target image; the file generating device generates an image preview page based on the target path file; the file generating device can automatically generate the target path file required for developing a web page, without the need for manual creation of the target path file, thereby improving the efficiency of web page development and reducing the labor cost of web page development.
[0187] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0188] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A file generation method, characterized in that: include: Obtaining a target image required for developing a web page includes: obtaining an image resource path in response to a path information input operation; screening a target image that meets a preset image attribute condition from a resource library corresponding to the image resource path according to a preset image resolution and / or a preset image format; Perform image processing on the target image to obtain attribute information of the target image; Generating a target path file required for developing a web page according to the attribute information of the target image, including: writing the image name, image height, image width and image import path of the target image into a file according to a set arrangement order to generate the target path file; Based on the target path file, a picture preview page is generated, wherein the picture preview page displays attribute information of the target picture.
2. The method according to claim 1, characterized in that: The step of obtaining the image resource path in response to the path information input operation includes: Displaying a command line tool interface, wherein the command line tool interface includes information input items; In response to the operation of inputting the image resource path in the information input item, the image resource path is acquired.
3. The method according to claim 1, characterized in that: The step of performing image processing on the target image to obtain attribute information of the target image includes: According to a preset naming rule, the picture name of the target picture is corrected to obtain a corrected picture name of the target picture; and Analyze the information of the target image to obtain the image height, image width and location path of the target image; According to the location path of the target image, an introduction path of the target image is generated.
4. The method according to claim 3, characterized in that The step of correcting the image name of the target image according to a preset naming rule to obtain the corrected image name of the target image includes at least one of the following correction methods: Recognize the target setting characters contained in the picture name of the target picture, and remove the recognized target setting characters from the picture name of the target picture; Identify a Chinese text segment contained in the picture name of the target picture, and replace the identified Chinese text segment with an English text segment corresponding to the Chinese text segment; Identify the uppercase letters contained in the picture name of the target picture, and replace the identified uppercase letters with lowercase letters.
5. The method according to claim 3, characterized in that: The step of generating an import path of the target image according to the location path of the target image includes: Obtain the location path of the target path file; Determine the target directory level corresponding to the target image according to the location path of the target path file; The image import path of the target image is generated according to the target directory level corresponding to the target image and the location path of the target image.
6. The method according to claim 1, characterized in that The step of generating a picture preview page based on the target path file includes: The target path file is used to render the hypertext markup language file to generate the image preview page.
7. A file generating device, characterized in that: include: The acquisition module is used to acquire the target image required for developing the web page, including: in response to the path information input operation, acquiring the image resource path; and screening the target image that meets the preset image attribute conditions from the resource library corresponding to the image resource path according to the preset image resolution and / or preset image format; An image processing module is used to process the target image to obtain attribute information of the target image; A file generation module is used to generate a target path file required for developing a web page according to the attribute information of the target image, including: writing the image name, image height, image width and image import path of the target image into a file according to a set arrangement order to generate the target path file; The page generation module is used to generate a picture preview page based on the target path file, wherein the picture preview page displays the attribute information of the target picture.
8. The file generating device according to claim 7, characterized in that: When the acquisition module obtains the image resource path in response to the path information input operation, it is used to display the command line tool interface, and the command line tool interface includes an information input item; in response to the operation of inputting the image resource path in the information input item, the image resource path is obtained.
9. The file generating device according to claim 7, characterized in that: The image processing module includes a correction submodule, a parsing submodule and a generation submodule; A correction submodule, used to correct the image name of the target image according to a preset naming rule to obtain the corrected image name of the target image; as well as The parsing submodule is used to parse the target image information to obtain the image height, image width and location path of the target image; The generation submodule is used to generate an import path of the target image according to the location path of the target image.
10. The file generating device according to claim 9, characterized in that: The correction submodule corrects the picture name of the target picture according to the preset naming rule to obtain the corrected picture name of the target picture, including at least one of the following correction methods: Recognize the target setting characters contained in the picture name of the target picture, and remove the recognized target setting characters from the picture name of the target picture; Identify a Chinese text segment contained in the picture name of the target picture, and replace the identified Chinese text segment with an English text segment corresponding to the Chinese text segment; Identify the uppercase letters contained in the picture name of the target picture, and replace the identified uppercase letters with lowercase letters.
11. The file generating device according to claim 9, characterized in that: The generating submodule is used to obtain the location path of the target path file when generating the import path of the target image according to the location path of the target image; Determine the target directory level corresponding to the target image according to the location path of the target path file; The image import path of the target image is generated according to the target directory level corresponding to the target image and the location path of the target image.
12. The file generating device according to claim 7, characterized in that: When generating the picture preview page based on the target path file, the file generation module is used to render the hypertext markup language file using the target path file to generate the picture preview page.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement each step in the method according to any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute each step in the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Tapestry framework-based method for previewing images in real time
CN102508864A
