Change default README to English, add language switcher
This commit is contained in:
1 parent
59f567857b
commit
027b2dd9b7
3 files changed
+356
-352
No files matched your search
-249
@@ -1,249 +0,0 @@
|
||||
# Z-Image - Free AI Image Generator 🎨
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://nextjs.org/)
|
||||
[](https://pages.cloudflare.com/)
|
||||
|
||||
A free AI image generator powered by [Pollinations AI](https://pollinations.ai/). No login required, generate high-quality images instantly.
|
||||
|
||||
> 🌐 **Live Demo**: [https://z-img.pics](https://z-img.pics)
|
||||
> 🎬 **Video Generation**: [VideoDance.cc](https://videodance.cc/) - Bring your images to life!
|
||||
|
||||
---
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- 🚀 **Lightning Fast** - Powered by Pollinations AI, sub-second response
|
||||
- 🔓 **No Login Required** - Start creating immediately
|
||||
- 🎨 **High Quality** - Multiple resolutions and enhancement modes
|
||||
- 🌍 **Multi-language** - 12 language interfaces
|
||||
- 💾 **Local Cache** - Auto-save history (7 days)
|
||||
- 📱 **Responsive Design** - Perfect mobile experience
|
||||
- 🔒 **Request Signature** - Anti-abuse protection
|
||||
- ⚡ **Rate Limiting** - Built-in protection via Cloudflare Pages Function
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Tech Stack
|
||||
|
||||
- **Frontend Framework**: [Next.js 14](https://nextjs.org/) (App Router)
|
||||
- **Styling**: [TailwindCSS](https://tailwindcss.com/)
|
||||
- **Icons**: [Lucide React](https://lucide.dev/)
|
||||
- **Image Generation**: [Pollinations AI API](https://pollinations.ai/)
|
||||
- **Deployment**: [Cloudflare Pages](https://pages.cloudflare.com/)
|
||||
- **Language**: TypeScript
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Local Development
|
||||
|
||||
1. **Clone the repository**
|
||||
```bash
|
||||
git clone https://github.com/your-username/z-img.git
|
||||
cd z-img
|
||||
```
|
||||
|
||||
2. **Install dependencies**
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Or using pnpm (recommended, this project uses pnpm):
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
3. **Configure environment variables**
|
||||
|
||||
Copy the example environment file:
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
Then edit `.env.local` and fill in your Pollinations AI Token:
|
||||
```env
|
||||
# Pollinations AI Token
|
||||
# Get yours at: https://pollinations.ai/
|
||||
POLLINATIONS_TOKEN=sk_your_actual_token_here
|
||||
```
|
||||
|
||||
> 💡 **How to get Token**: Visit [https://pollinations.ai/](https://pollinations.ai/), register an account, and get the server-side key starting with `sk_` from your dashboard.
|
||||
|
||||
4. **Start development server**
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Or using pnpm:
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
5. Open [http://localhost:3000](http://localhost:3000) in your browser 🎉
|
||||
|
||||
---
|
||||
|
||||
## 📦 Deployment
|
||||
|
||||
### Cloudflare Pages (Recommended)
|
||||
|
||||
1. **Fork this repository to your GitHub**
|
||||
|
||||
2. **Connect to Cloudflare Pages**
|
||||
- Login to [Cloudflare Dashboard](https://dash.cloudflare.com/)
|
||||
- Go to `Workers & Pages` → `Create application` → `Pages`
|
||||
- Connect your GitHub repository
|
||||
|
||||
3. **Build Configuration**
|
||||
```
|
||||
Framework preset: Next.js (Static HTML Export)
|
||||
Build command: npm run build
|
||||
Build output directory: out
|
||||
```
|
||||
|
||||
4. **Set Environment Variables**
|
||||
|
||||
Add in Cloudflare Pages project settings:
|
||||
```
|
||||
POLLINATIONS_TOKEN=sk_your_token_here
|
||||
```
|
||||
|
||||
5. **Deploy!** 🎉
|
||||
|
||||
### Vercel Deployment
|
||||
|
||||
```bash
|
||||
vercel deploy
|
||||
```
|
||||
|
||||
Remember to add `POLLINATIONS_TOKEN` environment variable in Vercel project settings.
|
||||
|
||||
### Netlify Deployment
|
||||
|
||||
```bash
|
||||
netlify deploy --prod
|
||||
```
|
||||
|
||||
Also add `POLLINATIONS_TOKEN` in Netlify environment variables.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 API Documentation
|
||||
|
||||
This project uses the free [Pollinations AI](https://pollinations.ai/) image generation API:
|
||||
|
||||
**Endpoint**: `GET https://gen.pollinations.ai/image/{prompt}`
|
||||
|
||||
**Supported Parameters**:
|
||||
- `width`, `height` - Image dimensions
|
||||
- `seed` - Random seed (reproducible)
|
||||
- `enhance` - AI enhancement mode
|
||||
- `model` - Model to use (default `zimage`)
|
||||
- `negative_prompt` - Negative prompts
|
||||
|
||||
**Authentication**: Add `Authorization: Bearer sk_xxx` header
|
||||
|
||||
Get your API Token: [https://pollinations.ai/](https://pollinations.ai/)
|
||||
|
||||
---
|
||||
|
||||
## 📂 Project Structure
|
||||
|
||||
```
|
||||
z-img/
|
||||
├── src/
|
||||
│ ├── app/
|
||||
│ │ ├── api/
|
||||
│ │ │ └── generate/
|
||||
│ │ │ └── route.ts # Next.js API route (local dev)
|
||||
│ │ ├── globals.css
|
||||
│ │ ├── layout.tsx
|
||||
│ │ ├── page.tsx
|
||||
│ │ ├── sitemap.ts
|
||||
│ │ └── robots.ts
|
||||
│ ├── components/
|
||||
│ │ ├── Header.tsx # Top navigation
|
||||
│ │ ├── Hero.tsx # Image generator UI
|
||||
│ │ ├── Gallery.tsx # Sample gallery
|
||||
│ │ ├── Features.tsx # Features showcase
|
||||
│ │ ├── About.tsx # About page
|
||||
│ │ ├── FAQ.tsx # FAQ accordion
|
||||
│ │ ├── Footer.tsx # Footer
|
||||
│ │ └── LanguageSelector.tsx # Language switcher
|
||||
│ ├── i18n/
|
||||
│ │ ├── locales.ts
|
||||
│ │ └── translations.ts # 12 language translations
|
||||
│ └── utils/
|
||||
│ └── imageCache.ts # Local image cache
|
||||
├── functions/
|
||||
│ └── api/
|
||||
│ └── generate.js # Cloudflare Pages Function
|
||||
├── public/
|
||||
│ └── images/ # Static images
|
||||
├── .env.example # Environment variables example
|
||||
└── next.config.mjs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Security Features
|
||||
|
||||
- **Request Signature Verification** - Timestamp + hash signature prevents replay attacks
|
||||
- **Referer/Origin Check** - Restrict allowed request sources
|
||||
- **Rate Limiting** - Prevent API abuse (Cloudflare Function)
|
||||
- **Environment Variables** - API tokens stored server-side, not exposed to frontend
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Links
|
||||
|
||||
- [Z-Img.pics](https://z-img.pics) - Live demo of this project
|
||||
- [VideoDance.cc](https://videodance.cc) - AI video generation
|
||||
- [NanoSora.art](https://nanosora.art) - AI art creation platform
|
||||
- [Pollinations.ai](https://pollinations.ai/) - Image generation API provider
|
||||
|
||||
---
|
||||
|
||||
## 📝 Roadmap
|
||||
|
||||
- [ ] Image editing features
|
||||
- [ ] Batch generation
|
||||
- [ ] More AI model options
|
||||
- [ ] Community sharing
|
||||
- [ ] API usage statistics
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Issues and Pull Requests are welcome!
|
||||
|
||||
1. Fork this repository
|
||||
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
||||
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
||||
5. Open a Pull Request
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the [MIT License](LICENSE).
|
||||
|
||||
---
|
||||
|
||||
## 💬 Contact
|
||||
|
||||
Questions or suggestions? Welcome to:
|
||||
- Submit [GitHub Issue](https://github.com/your-username/z-img/issues)
|
||||
- Visit [Live Demo](https://z-img.pics)
|
||||
|
||||
---
|
||||
|
||||
**⭐ If this project helps you, please give it a Star!**
|
||||
@@ -4,156 +4,158 @@
|
||||
[](https://nextjs.org/)
|
||||
[](https://pages.cloudflare.com/)
|
||||
|
||||
一个基于 [Pollinations AI](https://pollinations.ai/) 的免费 AI 图片生成器,无需登录,即刻生成高质量图片。
|
||||
[中文文档](README.zh.md) | English
|
||||
|
||||
> 🌐 **在线体验**: [https://z-img.pics](https://z-img.pics)
|
||||
> 🎬 **视频生成**: [VideoDance.cc](https://videodance.cc/) - 让你的图片动起来!
|
||||
A free AI image generator powered by [Pollinations AI](https://pollinations.ai/). No login required, generate high-quality images instantly.
|
||||
|
||||
> 🌐 **Live Demo**: [https://z-img.pics](https://z-img.pics)
|
||||
> 🎬 **Video Generation**: [VideoDance.cc](https://videodance.cc/) - Bring your images to life!
|
||||
|
||||
---
|
||||
|
||||
## ✨ 特性
|
||||
## ✨ Features
|
||||
|
||||
- � **极速生成** - 基于 Pollinations AI,秒级响应
|
||||
- 🔓 **无需登录** - 开箱即用,无需注册
|
||||
- 🎨 **高质量输出** - 支持多种分辨率和增强模式
|
||||
- 🌍 **多语言支持** - 12种语言界面
|
||||
- 💾 **本地缓存** - 自动保存历史记录(7天)
|
||||
- 📱 **响应式设计** - 完美适配移动端
|
||||
- 🔒 **请求签名验证** - 防止滥用和直接调用
|
||||
- ⚡ **速率限制** - Cloudflare Pages Function 内置限流保护
|
||||
- 🚀 **Lightning Fast** - Powered by Pollinations AI, sub-second response
|
||||
- 🔓 **No Login Required** - Start creating immediately
|
||||
- 🎨 **High Quality** - Multiple resolutions and enhancement modes
|
||||
- 🌍 **Multi-language** - 12 language interfaces
|
||||
- 💾 **Local Cache** - Auto-save history (7 days)
|
||||
- 📱 **Responsive Design** - Perfect mobile experience
|
||||
- 🔒 **Request Signature** - Anti-abuse protection
|
||||
- ⚡ **Rate Limiting** - Built-in protection via Cloudflare Pages Function
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ 技术栈
|
||||
## 🛠️ Tech Stack
|
||||
|
||||
- **前端框架**: [Next.js 14](https://nextjs.org/) (App Router)
|
||||
- **样式方案**: [TailwindCSS](https://tailwindcss.com/)
|
||||
- **图标库**: [Lucide React](https://lucide.dev/)
|
||||
- **图片生成**: [Pollinations AI API](https://pollinations.ai/)
|
||||
- **部署平台**: [Cloudflare Pages](https://pages.cloudflare.com/)
|
||||
- **语言**: TypeScript
|
||||
- **Frontend Framework**: [Next.js 14](https://nextjs.org/) (App Router)
|
||||
- **Styling**: [TailwindCSS](https://tailwindcss.com/)
|
||||
- **Icons**: [Lucide React](https://lucide.dev/)
|
||||
- **Image Generation**: [Pollinations AI API](https://pollinations.ai/)
|
||||
- **Deployment**: [Cloudflare Pages](https://pages.cloudflare.com/)
|
||||
- **Language**: TypeScript
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速开始
|
||||
## 🚀 Quick Start
|
||||
|
||||
### 本地开发
|
||||
### Local Development
|
||||
|
||||
1. **克隆项目**
|
||||
1. **Clone the repository**
|
||||
```bash
|
||||
git clone https://github.com/your-username/z-img.git
|
||||
cd z-img
|
||||
```
|
||||
|
||||
2. **安装依赖**
|
||||
2. **Install dependencies**
|
||||
|
||||
使用 npm:
|
||||
Using npm:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
或使用 pnpm(推荐,本项目使用 pnpm):
|
||||
Or using pnpm (recommended, this project uses pnpm):
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
3. **配置环境变量**
|
||||
3. **Configure environment variables**
|
||||
|
||||
复制示例环境变量文件:
|
||||
Copy the example environment file:
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
然后编辑 `.env.local`,填入你的 Pollinations AI Token:
|
||||
Then edit `.env.local` and fill in your Pollinations AI Token:
|
||||
```env
|
||||
# Pollinations AI Token
|
||||
# 获取地址: https://pollinations.ai/
|
||||
# Get yours at: https://pollinations.ai/
|
||||
POLLINATIONS_TOKEN=sk_your_actual_token_here
|
||||
```
|
||||
|
||||
> 💡 **如何获取 Token**:访问 [https://pollinations.ai/](https://pollinations.ai/),注册账号后在个人中心获取以 `sk_` 开头的服务端密钥。
|
||||
> 💡 **How to get Token**: Visit [https://pollinations.ai/](https://pollinations.ai/), register an account, and get the server-side key starting with `sk_` from your dashboard.
|
||||
|
||||
4. **启动开发服务器**
|
||||
4. **Start development server**
|
||||
|
||||
使用 npm:
|
||||
Using npm:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
或使用 pnpm:
|
||||
Or using pnpm:
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
5. 在浏览器中打开 [http://localhost:3000](http://localhost:3000) 🎉
|
||||
5. Open [http://localhost:3000](http://localhost:3000) in your browser 🎉
|
||||
|
||||
---
|
||||
|
||||
## 📦 部署指南
|
||||
## 📦 Deployment
|
||||
|
||||
### Cloudflare Pages 部署(推荐)
|
||||
### Cloudflare Pages (Recommended)
|
||||
|
||||
1. **Fork 本仓库到你的 GitHub**
|
||||
1. **Fork this repository to your GitHub**
|
||||
|
||||
2. **连接到 Cloudflare Pages**
|
||||
- 登录 [Cloudflare Dashboard](https://dash.cloudflare.com/)
|
||||
- 进入 `Workers & Pages` → `Create application` → `Pages`
|
||||
- 连接你的 GitHub 仓库
|
||||
2. **Connect to Cloudflare Pages**
|
||||
- Login to [Cloudflare Dashboard](https://dash.cloudflare.com/)
|
||||
- Go to `Workers & Pages` → `Create application` → `Pages`
|
||||
- Connect your GitHub repository
|
||||
|
||||
3. **构建配置**
|
||||
3. **Build Configuration**
|
||||
```
|
||||
Framework preset: Next.js (Static HTML Export)
|
||||
Build command: npm run build
|
||||
Build output directory: out
|
||||
```
|
||||
|
||||
4. **设置环境变量**
|
||||
4. **Set Environment Variables**
|
||||
|
||||
在 Cloudflare Pages 项目设置中添加:
|
||||
Add in Cloudflare Pages project settings:
|
||||
```
|
||||
POLLINATIONS_TOKEN=sk_your_token_here
|
||||
```
|
||||
|
||||
5. **部署完成!** 🎉
|
||||
5. **Deploy!** 🎉
|
||||
|
||||
### Vercel 部署
|
||||
### Vercel Deployment
|
||||
|
||||
```bash
|
||||
vercel deploy
|
||||
```
|
||||
|
||||
记得在 Vercel 项目设置中添加 `POLLINATIONS_TOKEN` 环境变量。
|
||||
Remember to add `POLLINATIONS_TOKEN` environment variable in Vercel project settings.
|
||||
|
||||
### Netlify 部署
|
||||
### Netlify Deployment
|
||||
|
||||
```bash
|
||||
netlify deploy --prod
|
||||
```
|
||||
|
||||
同样需要在 Netlify 环境变量中配置 `POLLINATIONS_TOKEN`。
|
||||
Also add `POLLINATIONS_TOKEN` in Netlify environment variables.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 API 说明
|
||||
## 🔑 API Documentation
|
||||
|
||||
本项目使用 [Pollinations AI](https://pollinations.ai/) 的免费图片生成 API:
|
||||
This project uses the free [Pollinations AI](https://pollinations.ai/) image generation API:
|
||||
|
||||
**端点**: `GET https://gen.pollinations.ai/image/{prompt}`
|
||||
**Endpoint**: `GET https://gen.pollinations.ai/image/{prompt}`
|
||||
|
||||
**支持参数**:
|
||||
- `width`, `height` - 图片尺寸
|
||||
- `seed` - 随机种子(可复现)
|
||||
- `enhance` - AI 增强模式
|
||||
- `model` - 使用的模型(默认 `zimage`)
|
||||
- `negative_prompt` - 负面提示词
|
||||
**Supported Parameters**:
|
||||
- `width`, `height` - Image dimensions
|
||||
- `seed` - Random seed (reproducible)
|
||||
- `enhance` - AI enhancement mode
|
||||
- `model` - Model to use (default `zimage`)
|
||||
- `negative_prompt` - Negative prompts
|
||||
|
||||
**认证**: 需要在请求头中添加 `Authorization: Bearer sk_xxx`
|
||||
**Authentication**: Add `Authorization: Bearer sk_xxx` header
|
||||
|
||||
获取你的 API Token: [https://pollinations.ai/](https://pollinations.ai/)
|
||||
Get your API Token: [https://pollinations.ai/](https://pollinations.ai/)
|
||||
|
||||
---
|
||||
|
||||
## 📂 项目结构
|
||||
## 📂 Project Structure
|
||||
|
||||
```
|
||||
z-img/
|
||||
@@ -161,89 +163,89 @@ z-img/
|
||||
│ ├── app/
|
||||
│ │ ├── api/
|
||||
│ │ │ └── generate/
|
||||
│ │ │ └── route.ts # Next.js API 路由(本地开发)
|
||||
│ │ │ └── route.ts # Next.js API route (local dev)
|
||||
│ │ ├── globals.css
|
||||
│ │ ├── layout.tsx
|
||||
│ │ ├── page.tsx
|
||||
│ │ ├── sitemap.ts
|
||||
│ │ └── robots.ts
|
||||
│ ├── components/
|
||||
│ │ ├── Header.tsx # 顶部导航
|
||||
│ │ ├── Hero.tsx # 图片生成主界面
|
||||
│ │ ├── Gallery.tsx # 示例画廊
|
||||
│ │ ├── Features.tsx # 特性展示
|
||||
│ │ ├── About.tsx # 关于页面
|
||||
│ │ ├── FAQ.tsx # 常见问题
|
||||
│ │ ├── Footer.tsx # 页脚
|
||||
│ │ └── LanguageSelector.tsx # 语言切换器
|
||||
│ │ ├── Header.tsx # Top navigation
|
||||
│ │ ├── Hero.tsx # Image generator UI
|
||||
│ │ ├── Gallery.tsx # Sample gallery
|
||||
│ │ ├── Features.tsx # Features showcase
|
||||
│ │ ├── About.tsx # About page
|
||||
│ │ ├── FAQ.tsx # FAQ accordion
|
||||
│ │ ├── Footer.tsx # Footer
|
||||
│ │ └── LanguageSelector.tsx # Language switcher
|
||||
│ ├── i18n/
|
||||
│ │ ├── locales.ts
|
||||
│ │ └── translations.ts # 12种语言翻译
|
||||
│ │ └── translations.ts # 12 language translations
|
||||
│ └── utils/
|
||||
│ └── imageCache.ts # 本地图片缓存工具
|
||||
│ └── imageCache.ts # Local image cache
|
||||
├── functions/
|
||||
│ └── api/
|
||||
│ └── generate.js # Cloudflare Pages Function
|
||||
├── public/
|
||||
│ └── images/ # 静态图片资源
|
||||
├── .env.example # 环境变量示例
|
||||
│ └── images/ # Static images
|
||||
├── .env.example # Environment variables example
|
||||
└── next.config.mjs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 安全特性
|
||||
## 🔒 Security Features
|
||||
|
||||
- **请求签名验证** - 使用时间戳 + 哈希签名防止重放攻击
|
||||
- **Referer/Origin 检查** - 限制允许的请求来源
|
||||
- **速率限制** - 防止 API 滥用(Cloudflare Function)
|
||||
- **环境变量** - API Token 存储在服务器端,不暴露到前端
|
||||
- **Request Signature Verification** - Timestamp + hash signature prevents replay attacks
|
||||
- **Referer/Origin Check** - Restrict allowed request sources
|
||||
- **Rate Limiting** - Prevent API abuse (Cloudflare Function)
|
||||
- **Environment Variables** - API tokens stored server-side, not exposed to frontend
|
||||
|
||||
---
|
||||
|
||||
## 🌐 友情链接
|
||||
## 🌐 Links
|
||||
|
||||
- [Z-Img.pics](https://z-img.pics) - 在线体验本项目
|
||||
- [VideoDance.cc](https://videodance.cc) - AI 视频生成,让图片动起来
|
||||
- [NanoSora.art](https://nanosora.art) - AI 艺术创作平台
|
||||
- [Pollinations.ai](https://pollinations.ai/) - 提供图片生成 API
|
||||
- [Z-Img.pics](https://z-img.pics) - Live demo of this project
|
||||
- [VideoDance.cc](https://videodance.cc) - AI video generation
|
||||
- [NanoSora.art](https://nanosora.art) - AI art creation platform
|
||||
- [Pollinations.ai](https://pollinations.ai/) - Image generation API provider
|
||||
|
||||
---
|
||||
|
||||
## 📝 开发计划
|
||||
## 📝 Roadmap
|
||||
|
||||
- [ ] 添加图片编辑功能
|
||||
- [ ] 支持批量生成
|
||||
- [ ] 添加更多 AI 模型选择
|
||||
- [ ] 社区分享功能
|
||||
- [ ] API 使用统计
|
||||
- [ ] Image editing features
|
||||
- [ ] Batch generation
|
||||
- [ ] More AI model options
|
||||
- [ ] Community sharing
|
||||
- [ ] API usage statistics
|
||||
|
||||
---
|
||||
|
||||
## 🤝 贡献
|
||||
## 🤝 Contributing
|
||||
|
||||
欢迎提交 Issue 和 Pull Request!
|
||||
Issues and Pull Requests are welcome!
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 创建你的特性分支 (`git checkout -b feature/AmazingFeature`)
|
||||
3. 提交你的改动 (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
||||
5. 打开一个 Pull Request
|
||||
1. Fork this repository
|
||||
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
||||
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
||||
5. Open a Pull Request
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
本项目基于 [MIT License](LICENSE) 开源。
|
||||
This project is licensed under the [MIT License](LICENSE).
|
||||
|
||||
---
|
||||
|
||||
## 💬 联系我们
|
||||
## 💬 Contact
|
||||
|
||||
有问题或建议?欢迎:
|
||||
- 提交 [GitHub Issue](https://github.com/your-username/z-img/issues)
|
||||
- 访问 [在线体验站](https://z-img.pics)
|
||||
Questions or suggestions? Welcome to:
|
||||
- Submit [GitHub Issue](https://github.com/your-username/z-img/issues)
|
||||
- Visit [Live Demo](https://z-img.pics)
|
||||
|
||||
---
|
||||
|
||||
**⭐ 如果这个项目对你有帮助,请给个 Star!**
|
||||
**⭐ If this project helps you, please give it a Star!**
|
||||
+251
@@ -0,0 +1,251 @@
|
||||
# Z-Image - Free AI Image Generator 🎨
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://nextjs.org/)
|
||||
[](https://pages.cloudflare.com/)
|
||||
|
||||
中文文档 | [English](README.md)
|
||||
|
||||
一个基于 [Pollinations AI](https://pollinations.ai/) 的免费 AI 图片生成器,无需登录,即刻生成高质量图片。
|
||||
|
||||
> 🌐 **在线体验**: [https://z-img.pics](https://z-img.pics)
|
||||
> 🎬 **视频生成**: [VideoDance.cc](https://videodance.cc/) - 让你的图片动起来!
|
||||
|
||||
---
|
||||
|
||||
## ✨ 特性
|
||||
|
||||
- � **极速生成** - 基于 Pollinations AI,秒级响应
|
||||
- 🔓 **无需登录** - 开箱即用,无需注册
|
||||
- 🎨 **高质量输出** - 支持多种分辨率和增强模式
|
||||
- 🌍 **多语言支持** - 12种语言界面
|
||||
- 💾 **本地缓存** - 自动保存历史记录(7天)
|
||||
- 📱 **响应式设计** - 完美适配移动端
|
||||
- 🔒 **请求签名验证** - 防止滥用和直接调用
|
||||
- ⚡ **速率限制** - Cloudflare Pages Function 内置限流保护
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ 技术栈
|
||||
|
||||
- **前端框架**: [Next.js 14](https://nextjs.org/) (App Router)
|
||||
- **样式方案**: [TailwindCSS](https://tailwindcss.com/)
|
||||
- **图标库**: [Lucide React](https://lucide.dev/)
|
||||
- **图片生成**: [Pollinations AI API](https://pollinations.ai/)
|
||||
- **部署平台**: [Cloudflare Pages](https://pages.cloudflare.com/)
|
||||
- **语言**: TypeScript
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速开始
|
||||
|
||||
### 本地开发
|
||||
|
||||
1. **克隆项目**
|
||||
```bash
|
||||
git clone https://github.com/your-username/z-img.git
|
||||
cd z-img
|
||||
```
|
||||
|
||||
2. **安装依赖**
|
||||
|
||||
使用 npm:
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
或使用 pnpm(推荐,本项目使用 pnpm):
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
3. **配置环境变量**
|
||||
|
||||
复制示例环境变量文件:
|
||||
```bash
|
||||
cp .env.example .env.local
|
||||
```
|
||||
|
||||
然后编辑 `.env.local`,填入你的 Pollinations AI Token:
|
||||
```env
|
||||
# Pollinations AI Token
|
||||
# 获取地址: https://pollinations.ai/
|
||||
POLLINATIONS_TOKEN=sk_your_actual_token_here
|
||||
```
|
||||
|
||||
> 💡 **如何获取 Token**:访问 [https://pollinations.ai/](https://pollinations.ai/),注册账号后在个人中心获取以 `sk_` 开头的服务端密钥。
|
||||
|
||||
4. **启动开发服务器**
|
||||
|
||||
使用 npm:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
或使用 pnpm:
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
5. 在浏览器中打开 [http://localhost:3000](http://localhost:3000) 🎉
|
||||
|
||||
---
|
||||
|
||||
## 📦 部署指南
|
||||
|
||||
### Cloudflare Pages 部署(推荐)
|
||||
|
||||
1. **Fork 本仓库到你的 GitHub**
|
||||
|
||||
2. **连接到 Cloudflare Pages**
|
||||
- 登录 [Cloudflare Dashboard](https://dash.cloudflare.com/)
|
||||
- 进入 `Workers & Pages` → `Create application` → `Pages`
|
||||
- 连接你的 GitHub 仓库
|
||||
|
||||
3. **构建配置**
|
||||
```
|
||||
Framework preset: Next.js (Static HTML Export)
|
||||
Build command: npm run build
|
||||
Build output directory: out
|
||||
```
|
||||
|
||||
4. **设置环境变量**
|
||||
|
||||
在 Cloudflare Pages 项目设置中添加:
|
||||
```
|
||||
POLLINATIONS_TOKEN=sk_your_token_here
|
||||
```
|
||||
|
||||
5. **部署完成!** 🎉
|
||||
|
||||
### Vercel 部署
|
||||
|
||||
```bash
|
||||
vercel deploy
|
||||
```
|
||||
|
||||
记得在 Vercel 项目设置中添加 `POLLINATIONS_TOKEN` 环境变量。
|
||||
|
||||
### Netlify 部署
|
||||
|
||||
```bash
|
||||
netlify deploy --prod
|
||||
```
|
||||
|
||||
同样需要在 Netlify 环境变量中配置 `POLLINATIONS_TOKEN`。
|
||||
|
||||
---
|
||||
|
||||
## 🔑 API 说明
|
||||
|
||||
本项目使用 [Pollinations AI](https://pollinations.ai/) 的免费图片生成 API:
|
||||
|
||||
**端点**: `GET https://gen.pollinations.ai/image/{prompt}`
|
||||
|
||||
**支持参数**:
|
||||
- `width`, `height` - 图片尺寸
|
||||
- `seed` - 随机种子(可复现)
|
||||
- `enhance` - AI 增强模式
|
||||
- `model` - 使用的模型(默认 `zimage`)
|
||||
- `negative_prompt` - 负面提示词
|
||||
|
||||
**认证**: 需要在请求头中添加 `Authorization: Bearer sk_xxx`
|
||||
|
||||
获取你的 API Token: [https://pollinations.ai/](https://pollinations.ai/)
|
||||
|
||||
---
|
||||
|
||||
## 📂 项目结构
|
||||
|
||||
```
|
||||
z-img/
|
||||
├── src/
|
||||
│ ├── app/
|
||||
│ │ ├── api/
|
||||
│ │ │ └── generate/
|
||||
│ │ │ └── route.ts # Next.js API 路由(本地开发)
|
||||
│ │ ├── globals.css
|
||||
│ │ ├── layout.tsx
|
||||
│ │ ├── page.tsx
|
||||
│ │ ├── sitemap.ts
|
||||
│ │ └── robots.ts
|
||||
│ ├── components/
|
||||
│ │ ├── Header.tsx # 顶部导航
|
||||
│ │ ├── Hero.tsx # 图片生成主界面
|
||||
│ │ ├── Gallery.tsx # 示例画廊
|
||||
│ │ ├── Features.tsx # 特性展示
|
||||
│ │ ├── About.tsx # 关于页面
|
||||
│ │ ├── FAQ.tsx # 常见问题
|
||||
│ │ ├── Footer.tsx # 页脚
|
||||
│ │ └── LanguageSelector.tsx # 语言切换器
|
||||
│ ├── i18n/
|
||||
│ │ ├── locales.ts
|
||||
│ │ └── translations.ts # 12种语言翻译
|
||||
│ └── utils/
|
||||
│ └── imageCache.ts # 本地图片缓存工具
|
||||
├── functions/
|
||||
│ └── api/
|
||||
│ └── generate.js # Cloudflare Pages Function
|
||||
├── public/
|
||||
│ └── images/ # 静态图片资源
|
||||
├── .env.example # 环境变量示例
|
||||
└── next.config.mjs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 安全特性
|
||||
|
||||
- **请求签名验证** - 使用时间戳 + 哈希签名防止重放攻击
|
||||
- **Referer/Origin 检查** - 限制允许的请求来源
|
||||
- **速率限制** - 防止 API 滥用(Cloudflare Function)
|
||||
- **环境变量** - API Token 存储在服务器端,不暴露到前端
|
||||
|
||||
---
|
||||
|
||||
## 🌐 友情链接
|
||||
|
||||
- [Z-Img.pics](https://z-img.pics) - 在线体验本项目
|
||||
- [VideoDance.cc](https://videodance.cc) - AI 视频生成,让图片动起来
|
||||
- [NanoSora.art](https://nanosora.art) - AI 艺术创作平台
|
||||
- [Pollinations.ai](https://pollinations.ai/) - 提供图片生成 API
|
||||
|
||||
---
|
||||
|
||||
## 📝 开发计划
|
||||
|
||||
- [ ] 添加图片编辑功能
|
||||
- [ ] 支持批量生成
|
||||
- [ ] 添加更多 AI 模型选择
|
||||
- [ ] 社区分享功能
|
||||
- [ ] API 使用统计
|
||||
|
||||
---
|
||||
|
||||
## 🤝 贡献
|
||||
|
||||
欢迎提交 Issue 和 Pull Request!
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 创建你的特性分支 (`git checkout -b feature/AmazingFeature`)
|
||||
3. 提交你的改动 (`git commit -m 'Add some AmazingFeature'`)
|
||||
4. 推送到分支 (`git push origin feature/AmazingFeature`)
|
||||
5. 打开一个 Pull Request
|
||||
|
||||
---
|
||||
|
||||
## 📄 License
|
||||
|
||||
本项目基于 [MIT License](LICENSE) 开源。
|
||||
|
||||
---
|
||||
|
||||
## 💬 联系我们
|
||||
|
||||
有问题或建议?欢迎:
|
||||
- 提交 [GitHub Issue](https://github.com/your-username/z-img/issues)
|
||||
- 访问 [在线体验站](https://z-img.pics)
|
||||
|
||||
---
|
||||
|
||||
**⭐ 如果这个项目对你有帮助,请给个 Star!**
|
||||
Reference in new issue
Block a user