I. BACKGROUND
Today, suddenly found that the latest news thumbnails on the mobile client are not displayed, on the server looked at,
Discover that new news images do not generate thumbnails at all.
This set of news release system is very old program, checked, the problem is not support the PNG format of the picture, that is, if the large image is transmitted in PNG format, do not generate thumbnails.
Ii. Solutions
Because they are off work, there is no time to modify the program source code, only on the server, temporarily put all the PNG original, and then regenerate the thumbnail.
Exactly, this server has installed ImageMagick this very powerful image processing program, can easily generate thumbnails,
Then write a shell script, batch generation.
[Email protected] ~]# VI hutuseng.sh#!/bin/bashfor i in *.pngdo echo "Generate thumbnails $i ..." convert-thumbnail $i./t Humb_$idone[[email protected] ~]# chmod +x hutuseng.sh[[email protected] ~]#./hutuseng.sh
ImageMagick is a lot of usage, generating thumbnails is just one of its basic functions,
More can look at the example of it, http://www.imagemagick.org/script/examples.php
Batch create thumbnails under Linux shell