Hongmu Notes
Home Language Notes

Language Notes

PHP batch compression of images in the server

PHP batch compression of images in the server Language Notes PHP

Directly copy this entire section and execute cat > /www/wwwroot/blog2.1.4s5.cn/compress.php << 'EOF' <?php /** * WebP image batch compression script */ // ---- Increase memory ---- ini_set('memory_limit', '…
👁 11
PHP queries the MySQL database, obtains each table, and then outputs the first eight data of each table.

PHP queries the MySQL database, obtains each table, and then outputs the first eight data of each table. Language Notes PHP mySql

php code<?php /** * Export the table structure of the MySQL database and the first 8 data of each table * Data is in reverse order by id (if there is no id, it is in reverse order by primary key/first column) * Database: 111, username: 11111, password: 1111 */ $host = 'localhost'; $user = '1111'; $pa…
👁 57
A simple single page of the website can be used to introduce yourself, or it can be a single page for pure display.

A simple single page of the website can be used to introduce yourself, or it can be a single page for pure display. Language Notes CSS Summary of pitfalls

Record this single page. That is, the code for a simple page implementation is as follows: <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8" /> <meta name="viewport" content…
👁 64
Notes on website resource file source code description

Notes on website resource file source code description Language Notes

All source code resources on this site come from public channels on the Internet. We have built, installed and tested locally, and repaired and optimized a large number of compatibility issues (such as section confusion, abnormal styles, running errors, etc.). After eliminating resources that were inoperable or seriously defective, we moderately processed some pictures and display information, and finally compiled and released them for developers to learn and communicate. Due to limited website time and energy, there may still be some undiscovered resources...
👁 89
Python organizes data shared in batches on Baidu Netdisk

Python organizes data shared in batches on Baidu Netdisk Language Notes python

import pandas as pd import re import os # ---------- Input and output path ---------- csv_path = r"C:\Users\18102\Downloads\jietu\Baidu network disk sharing.csv" output_excel = r"C:\Use…
👁 48
python batch publish articles to wordpress sub-theme

python batch publish articles to wordpress sub-theme Language Notes python

Capture packets through fidder and write a python script. It is very convenient to collect articles and then publish them to the website. But this script is only suitable for use on this site. The code is currently placed here for backup. import requests import pandas as pd import re import time import os import jso…
👁 81
Python compresses website images in batches to slim down the website!

Python compresses website images in batches to slim down the website! Language Notes python

My website is very slow to open because the images are very large. So I thought of using python to compress images. Compress png into webp format, directly reducing the weight by 88%! The compression rate is very high, but it is very clear. 1.4G png is directly compressed to 120M, and it is very high-definition. Anyone else? ! The function of the Python script: recursively traverse all files in the uploads directory. Skip less than or equal to 300KB…
👁 433
Python batch cuts the left and right sides of pictures

Python batch cuts the left and right sides of pictures Language Notes Summary of pitfalls python

python code to automatically detect the distance between both sides of the image: import cv2 import numpy as np image_path = r"C:\Users\18102\Downloads\ok\0001.png" # Please change to the actual screenshot path img = cv2.imread(image_path) if …
👁 61
Python image query to remove duplicates and detect whether the file exists

Python image query to remove duplicates and detect whether the file exists Language Notes python

Use the script for your own use, keep the backup import os import re # ---------- Configuration ---------- ok_dir = r"C:\Users\18102\Downloads\ok" output_missing = "missing.txt" # Output to the directory where the current script is located # -------…
👁 49
Python measures picture width and height, interactive measurement script

Python measures picture width and height, interactive measurement script Language Notes python

import cv2 import numpy as np image_path = r"C:\Users\18102\Downloads\bg.png" # Read the image (retain alpha channel) img = cv2.imread(image_path, cv2.IMREAD_UNCHANGED) if …
👁 61
1 2 3 33