📸 What Is This? – AI Image Analyzer

Complete Installation & Configuration Guide

1. System Requirements
  • PHP 8.1 or higher (with extensions: pdo_mysql, curl, json, session, fileinfo, gd)
  • MySQL 5.7+ or MariaDB 10.3+
  • Apache / Nginx with mod_rewrite enabled
  • SSL certificate recommended (for payment gateways)
  • At least 64MB memory for PHP
2. Quick Installation (One-Click)
  1. Upload all files to your server (e.g., /public_html/whatisthis/)
  2. Ensure the uploads/ and assets/uploads/ directories are writable (chmod 755)
  3. Navigate to http://yoursite.com/whatisthis/install/
  4. Follow the steps:
    • Enter your database credentials (host, name, user, password)
    • Create an admin account (email & password)
    • (Optional) Add Gemini API key
  5. After installation, delete the /install folder for security.
📌 The installer will automatically create the database and tables. If you encounter permission errors, you can import database.sql manually via phpMyAdmin.
3. Manual Setup (if installer fails)
  1. Create a database (e.g., whatisthis) via your hosting control panel.
  2. Import the SQL schema from install/database.sql (use phpMyAdmin or command line).
  3. Create a file config.local.php in the root folder with your database credentials:
    <?php
    define('DB_HOST', 'localhost');
    define('DB_NAME', 'your_database_name');
    define('DB_USER', 'your_db_user');
    define('DB_PASS', 'your_db_password');
    
  4. Visit install/install.php?step=2 to complete admin account setup.
  5. Delete the /install folder after success.
4. Configuration

General Settings

  • Log in as admin → Admin PanelBranding – set site name, logo, favicon.
  • SEO – set meta title, description, keywords.
  • Email – configure SMTP or Formspree for sending OTPs and notifications.

AI Provider (Gemini)

  1. Get a Gemini API key from Google AI Studio (free tier).
  2. In admin panel → AI Settings, select Google Gemini and paste the key.
  3. Test by uploading an image – you should receive a description.
Note: The platform uses gemini-2.5-flash model. Ensure your key has access to it (free tier works).

Subscription Plans

  • Go to Admin Panel → Subscription Plans.
  • Add/edit plans: name, price, currency, analyses per month, features (JSON array).
  • The “Free” plan (price=0) is automatically used for non‑subscribed users.
5. Payment Gateways Setup

Stripe

  1. Sign up at stripe.com (no credit card needed for test keys).
  2. Get your Publishable Key and Secret Key from the Stripe Dashboard → Developers → API keys.
  3. In admin panel → Payment Portal, select Stripe and enable it. Enter both keys.
  4. Set a webhook endpoint (optional) – you can skip for simple checkout.

PayPal

  1. Create a PayPal developer account at developer.paypal.com.
  2. Create a REST API app → get Client ID and Secret.
  3. In admin panel → Payment Portal, enable PayPal and enter both credentials.
  4. Use sandbox mode for testing; switch to live when ready.

Mollie

  1. Register at mollie.com (free tier available).
  2. Get your API key from the Mollie Dashboard → Developers → API keys.
  3. In admin panel → Payment Portal, enable Mollie and enter the key.
💡 After configuring at least one gateway, users can upgrade to paid plans. The payment flow redirects to the chosen gateway, then returns to your site.
6. Email Delivery (OTP & Notifications)
  • Go to Admin Panel → Email.
  • Choose provider:
    • SMTP – enter your SMTP host, port, username, password, encryption (TLS/SSL).
    • Formspree – provide your Formspree endpoint (free tier).
  • Set “From Email” and “From Name”.
  • Test by registering a new user – you should receive an OTP.
7. User Guide
  • Registration – enter email and password; an OTP is sent to verify the email (or you can copy it from the modal).
  • Login – use email and password.
  • Analyzing an image – drag & drop or click “Choose file”, then click “Analyze”. The result will show title, description, and key facts.
  • Subscription – go to “Pricing” page, select a plan, and follow the payment flow (if paid). Free plan is instant.
  • History – view all past analyses with thumbnails; click “View Details” to see full result.
  • Profile – update email, change password (OTP required), and see current plan.
8. Admin Guide
  • Dashboard – view stats, recent analyses, revenue charts.
  • Users – manage user accounts: activate/deactivate, change subscription plan, update monthly limit, delete users.
  • Subscription Plans – create/edit/delete plans. Features must be stored as a JSON array (e.g., ["Feature 1","Feature 2"]).
  • AI Settings – switch between providers (only Gemini for now), enter API keys.
  • Payment Portal – configure Stripe, PayPal, Mollie credentials.
  • Branding – upload logo and favicon, change site name and tagline.
  • SEO – meta tags for search engines.
  • Email – SMTP/Formspree configuration.
  • Localization – set default currency, country, timezone, date format.
9. Customization & Styling
  • Main CSS file: assets/css/style.css – modify colors, fonts, spacing.
  • Theme uses CSS variables; change --gold, --emerald etc.
  • Header and footer are located in includes/header.php and includes/footer.php – you can add custom links or scripts there.
  • For mobile menu, the header already uses Bootstrap's responsive navbar – no extra work needed.
10. Troubleshooting
  • Blank page / white screen – enable error reporting in functions.php by setting error_reporting(E_ALL); ini_set('display_errors', 1); temporarily.
  • Gemini API returns 403 – check that your API key has no referrer restrictions or that you added the Referer header in the code.
  • OTP not received – check email settings; you can also use the fallback OTP shown in the registration modal (if email fails).
  • Payment gateway error – ensure your API keys are correct and the endpoint is accessible (for PayPal, verify you’re using the correct environment).
  • Uploads not working – check folder permissions (uploads/ must be writable) and PHP upload limits (upload_max_filesize).
11. Security Recommendations
  • Delete the /install folder after installation.
  • Set proper file permissions: config.local.php should be readable only by the web server (e.g., 640).
  • Use HTTPS for all traffic (especially when handling payments).
  • Regularly update the platform and dependencies (if using Composer).
  • Enable rate limiting for API requests (already implemented for guests).
  • Store sensitive keys in environment variables or config.local.php (which is excluded from version control).
12. Support & Resources

For custom development or questions, refer to the inline comments in the source code.

© What Is This? – AI Image Analyzer. Documentation v1.0