Files
goimgApi/rules.md
Beyhan Oğur e6f3268c28 first commit
2026-04-26 21:48:15 +03:00

21 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Go Image Manipulation API - Project Rules (libvips/bimg Version)
## 1. Tech Stack
- Language: Go 1.26.1
- Web Framework: Fiber v3 (github.com/gofiber/fiber/v3)
- Image Engine: libvips via bimg (github.com/h2non/bimg)
- Database: GORM (MySQL) & Redis (Auth/Token storage)
## 2. Image Processing Logic
- Use `bimg` for all transformations.
- Supported Input/Output: AVIF, WEBP, PNG, JPG.
- Quality: Map 1-100 values to `bimg.Options.Quality`.
- Transformation Types:
- `Cover`: Use `bimg.Options.Enlarge = true` and `bimg.Options.Crop = true`.
- `Crop`: Use `bimg.Options.Type = bimg.ImageType` (Target format).
- `Resize`: Use `bimg.Options.Width` and `bimg.Options.Height`.
## 3. Performance & Safety
- **CRITICAL:** `libvips` C kaynaklarını kullanır. Bellek sızıntılarını önlemek için `bimg.VipsFree()` veya garbage collection dostu yapıları takip et.
- **Async Processing:** Büyük işlemler için Fiber'in `ctx.Next()` yapısını bozmadan `pool` mantığını değerlendir.
- **Redis Security:** Her manipülasyon isteği `?token=` parametresiyle gelmeli ve Redis'teki `image_id` ile eşleşmeli.