func ResizeLimit(img []byte, limit float64, quality int) (*bytes.Buffer, error) {
	src, err := ReadImage(img)
	if err != nil {
		return nil, err
	}
	w, h := limitWidthHeight(src.Bounds(), limit)
	small := imaging.Resize(src, w, h, imaging.Lanczos)
	return jpegEncode(small, quality)
}
ResizeLimit resizes the image if it's long side bigger than limit.
Use default limit 900 if limit is set to zero.
Use default quality 85 if quality is set to zero.
package thumb
import (
	"bytes"
	"image"
	"image/jpeg"
	"log"
	"math"
	"os"
	"os/exec"
	"strconv"
	"github.com/ahui2016/localtags/util"
	"github.com/disintegration/imaging"
	"golang.org/x/image/webp"
)
const (
	ffmpeg                 = "ffmpeg"
	ffprobe                = "ffprobe"
	defaultSize            = 128
	defaultQuality         = 85
	defaultLimit   float64 = 900
)
func NailWrite(imgPath, thumbPath string) error {
	img, err := os.ReadFile(imgPath)
	if err != nil {
		return err
	}
	return BytesToThumb(img, thumbPath)
}
func BytesToThumb(img []byte, thumbPath string) error {
	buf, err := Nail(img, 0, 0)
	if err != nil {
		return err
	}
	return util.CreateFile(thumbPath, buf)
}