E
E
ex3manet2016-10-31 00:05:24
Images
ex3manet, 2016-10-31 00:05:24

What program (method) for optimizing images for the site do you use?

Dear!
I ask you to advise a quick and high-quality way to optimize images (to increase the speed of loading a site on WP) / In general, I checked the site through Google Page Insights and in the results of the check you need to optimize images.
Interested in programs or methods where it is possible to quickly and efficiently compress JPG PNG images (by 20-30%) without changing the image resolution and file name. You need to process about 3-5k images.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mouvdy, 2016-10-31
@ex3manet

https://tinypng.com and their APIs

#!/bin/bash
API_KEY="ВАШ АПИ"

if [ $API_KEY = "CHANGE_ME" ]
then
  echo "CHANGE THE API_KEY in this file."
  exit 1
fi

if ! type "jq" > /dev/null
then
  echo "Please install `jq`"
  exit 1
fi

find /var/www/mobil1/data/www/site.com/files/categories -type f \( -name  \*.jpg -o -name \*.png -o -name \*.jpeg \) -print0 | while IFS= read -r -d '' file; do #Директория в которой искать файлы для оптимизации

  json=$(curl -sS --user api:$API_KEY --data-binary @$file https://api.tinypng.com/shrink)
  url=$(jq -n "$json.output.url" | sed -e 's/^"//'  -e 's/"$//')

curl -sS $url > $file
done

V
Victor Marquardt, 2016-10-31
@Cempl

File Optimizer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question