Updated config.example.php to match working config structure: Changes: - Load env_loader.php with file_exists check - Always define SSO_ENABLED, SSO_TENANT_ID, SSO_CLIENT_ID - Use !defined() checks to prevent redefinition errors - Defaults to false/empty if .env not found - Added error reporting settings Server-check.php improvements: - Shows actual SSO constant values (TRUE/FALSE/EMPTY) - Better diagnostic output DEPLOYMENT FIX: On server, update config.php to match config.example.php structure. This ensures SSO constants are always defined. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| uploads | ||
| .env.example | ||
| .gitignore | ||
| .htaccess | ||
| AI_IMPLEMENTATION_GUIDE.md | ||
| api.php | ||
| auth-test.php | ||
| auth.php | ||
| AUTH_README.md | ||
| AuthMiddleware.php | ||
| Banana.save | ||
| cleanup.php | ||
| clear_session.php | ||
| composer.json | ||
| config.example.php | ||
| debug.php | ||
| debug_request.php | ||
| enhance_prompt.php | ||
| env_loader.php | ||
| get_logs.php | ||
| index.php | ||
| INSTALL.md | ||
| JWTValidator.php | ||
| QUICK_REFERENCE.md | ||
| README.md | ||
| server-check.php | ||
| session_manager.php | ||
Nano Banana Pro Image Generator
A sleek HTML/PHP web application for generating and iteratively editing images using Google's Nano Banana Pro (Gemini 3 Pro Image Preview) API.
Features
- Text-to-Image Generation: Create images from text descriptions
- Iterative Editing: Refine images with natural language prompts like "make it red", "add sunset", "remove background"
- Multiple Resolutions: Support for 1K, 2K, and 4K image generation
- Multiple Aspect Ratios: 16:9, 1:1, 9:16, 4:3, 3:4, and more
- Conversation History: Track all your prompts and edits
- Quick Edit Buttons: Pre-configured editing shortcuts
- Modern UI: Clean black and gold design with Montserrat font
Requirements
- PHP 7.4 or higher
- cURL extension enabled
- Google Gemini API key with billing enabled
Installation
1. Get Your API Key
- Visit Google AI Studio
- Create a new API key
- Important: Enable billing on your Google Cloud account (Nano Banana Pro requires paid access)
2. Configure the Application
- Open
config.php - Add your API key:
define('GEMINI_API_KEY', 'YOUR_API_KEY_HERE');
3. Set Up Your Web Server
Option A: PHP Built-in Server (Development)
php -S localhost:8000
Then visit: http://localhost:8000
Option B: Apache/NGINX (Production)
- Point your web server document root to this directory
- Ensure PHP is properly configured
- Make sure session support is enabled
4. Configure Permissions
Ensure PHP can write session files:
chmod 755 /path/to/NANO-RESEARCH
Usage
Creating Your First Image
- Open the application in your browser
- Enter a detailed prompt in the text area (e.g., "A photorealistic sunset over mountains with dramatic clouds")
- Choose your preferred aspect ratio and resolution
- Click "Generate Image"
- Wait 10-30 seconds for the image to generate
Iterative Editing
Once you have an image:
- Enter edit instructions like:
- "Make the sky more orange"
- "Add a lake in the foreground"
- "Remove the clouds"
- "Make it look like a painting"
- Click "Edit Image"
- The AI will modify your existing image based on the instructions
Quick Edit Buttons
Use the pre-configured buttons for common edits:
- Add Lighting: Enhance dramatic lighting
- Add Sunset: Add sunset background
- More Vibrant: Increase color saturation
- Motion Blur: Add movement effect
- Photorealistic: Enhance realism
- Depth of Field: Add bokeh effect
Starting Over
Click "Start New Image" to clear your current image and conversation history.
API Pricing
Nano Banana Pro Pricing (as of 2025):
- 1K/2K images: ~$0.13 per image
- 4K images: ~$0.24 per image
Alternative Providers (20-50% cheaper):
To use alternative providers, modify the $baseUrl in api.php.
File Structure
NANO-RESEARCH/
├── index.php # Main application interface
├── api.php # Backend API handler
├── config.php # Configuration file (add your API key here)
├── config.example.php # Configuration template
└── README.md # This file
Troubleshooting
"API key not configured" Error
- Make sure you've added your API key to
config.php - Check that the API key is between the quotes:
define('GEMINI_API_KEY', 'your-key-here');
"API error: 403" or "Permission denied"
- Ensure billing is enabled on your Google Cloud account
- Nano Banana Pro requires a paid Google Cloud account (no free tier)
"Connection timeout" Error
- Image generation can take 10-60 seconds
- For 4K images, it may take longer
- Check your internet connection
Images Not Displaying
- Check browser console for errors
- Ensure PHP sessions are working (
session_start()errors) - Verify file permissions
"cURL error" Messages
- Ensure PHP cURL extension is installed and enabled
- Check:
php -m | grep curl - Install if missing:
sudo apt-get install php-curl(Ubuntu/Debian)
Security Notes
- Never commit
config.phpto version control - it contains your API key - The API key should be kept secret
- Consider adding rate limiting for production use
- Add
.htaccessor nginx rules to prevent direct access toconfig.php
Recommended .htaccess
<Files "config.php">
Require all denied
</Files>
Tips for Best Results
Writing Good Prompts
- Be specific and descriptive
- Include style (e.g., "photorealistic", "oil painting", "digital art")
- Mention lighting (e.g., "golden hour", "studio lighting")
- Specify composition (e.g., "close-up", "wide angle")
Good Example:
A photorealistic close-up of a red sports car on a coastal highway
at sunset, with dramatic golden lighting and motion blur on the wheels
Poor Example:
car
Iterative Editing Tips
- Make one change at a time for better control
- Use clear, specific instructions
- Reference existing elements (e.g., "make the car in the image red")
- Build up changes gradually
Advanced Configuration
Changing the Model
To use Nano Banana (faster, cheaper) instead of Nano Banana Pro:
Edit api.php:
private $model = 'gemini-2.5-flash-image'; // Instead of gemini-3-pro-image-preview
Using Alternative API Providers
To use Kie.ai or fal.ai:
Edit api.php:
// For Kie.ai
private $baseUrl = 'https://api.kie.ai/v1/models';
// For fal.ai
private $baseUrl = 'https://queue.fal.run';
Refer to their respective documentation for authentication details.
Increasing Timeout
For slower connections or 4K images, increase timeout in api.php:
CURLOPT_TIMEOUT => 180 // 3 minutes instead of 2
License
This project is open source. Use it however you want.
Support
For issues with:
- This application: Check troubleshooting section above
- Nano Banana Pro API: Visit Google AI Documentation
- Billing: Contact Google Cloud support
Credits
Built with:
- Google Nano Banana Pro (Gemini 3 Pro Image Preview)
- PHP & cURL
- Montserrat font by Google Fonts