📜 ⬆️ ⬇️

About the benefits of the console

Situation. There is a folder with photos that need to be shown on the site with clickable thumbes.
We do it once: for f in *.jpg ; do convert -quality 90 -resize 80 "$f" "${f%.jpg}-thumb.jpg" ; done for f in *.jpg ; do convert -quality 90 -resize 80 "$f" "${f%.jpg}-thumb.jpg" ; done
We do two: for f in *-thumb.jpg ; do echo "<a href=\"./photos/${f%-thumb.jpg}.jpg\"><img src=\"./photos/$f\" alt=\"\" width=\"80\" height=\"53\"></a>" ; done for f in *-thumb.jpg ; do echo "<a href=\"./photos/${f%-thumb.jpg}.jpg\"><img src=\"./photos/$f\" alt=\"\" width=\"80\" height=\"53\"></a>" ; done
That's all. It remains only to copy the resulting line and paste it on the desired page. To type these two commands is a couple of minutes, taking into account the fact that I do not remember very well the syntax of bash (there you need to know the substitution) and convert.

I am afraid to think how much time it would take if done with my hands. Photos 32; On each would probably leave a minute. That is, it is half an hour of continuous work.

')

Source: https://habr.com/ru/post/15445/


All Articles