Home > Article > Backend Development > Generate image thumbnails in batches with PHP (1/5)_PHP tutorial
PHP Batch Generate Image Thumbnails This batch generation thumbnail code can generate small images of a specified size, and supports batch uploading of files.
PHP tutorial to batch generate image thumbnails
This batch generation thumbnail code can generate small images of a specified size, and supports batch uploading of files.
This tutorial will use the php file
view.php
config.php
funs.php
index.php
Function:
-----------------------
1. Generate thumbnails of specified size for the pictures in the folder
2. List sub-files folder, you can specify a folder to generate
3. To facilitate the generation of thumbnails of different sizes, the images are saved to a new directory, while the directory structure remains unchanged
Implementation:
---- ------------------
1. Original image folder $image
2. Save it in $newimage
after processing to keep the directory structure and file name Unchanged (easy to call)
3. If the image already exists in the new folder, skip directly
operation interface:
------------- ----------
1.$image input box
2.$newimage input box (if not filled in, it will be the directory with the thumbnail size as the file name that is equal to the current directory)
3. Press "Search" to list all folders, generate cache, and write to files.
4. Generate. Generate subdirectories
*/
?>
//index.php code