first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:48:15 +03:00
commit e6f3268c28
50 changed files with 4930 additions and 0 deletions

21
rules.md Normal file
View File

@@ -0,0 +1,21 @@
# 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.