Plant Disease Detector
πΏ AI-powered WordPress plugin for plant disease detection. Supports Google AI Studio, Ollama (local), and OpenRouter. Features multilingual reports (20+ languages), scan history, RTL support, and drag-and-drop image upload.
by Ahmad Wael Β· github.com/devwael/plant-disease-detector Β· website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/devwael/plant-disease-detector/archive/refs/heads/main.zipReadme
Plant Disease Detector
A WordPress plugin that uses AI vision models to detect plant diseases from images. Simply upload a photo of your plant and get instant diagnosis with treatment recommendations.
πΏ Features
- AI-Powered Analysis β Identify plant species and detect diseases using advanced vision AI models
- Multiple AI Providers β Choose between Google AI Studio, Ollama (local), or OpenRouter
- Multilingual Reports β Get analysis results in 20+ languages including Arabic, Spanish, French, Chinese, and more
- Scan History β Logged-in users can view, manage, and delete their past scans
- RTL Support β Full right-to-left language support for Arabic, Persian, and Urdu
- Modern UI β Clean, responsive design with drag-and-drop, paste (Ctrl+V), and click-to-upload support
- Privacy Focused β Scans are stored per-user as custom post types
π¦ Requirements
- WordPress 5.0+
- PHP 7.4+
- An API key from one of the supported AI providers
βοΈ Installation
-
Download or clone this repository into your
/wp-content/plugins/directory:cd /wp-content/plugins/ git clone https://github.com/bbioon/plant-disease-detector.git -
Install Composer dependencies:
cd plant-disease-detector composer install -
Activate the plugin in Plugins β Installed Plugins
-
Configure your AI provider in Settings β Plant Detector
π§ Configuration
Navigate to Settings β Plant Detector to configure:
AI Providers
| Provider | API Key Required | Models |
|---|---|---|
| Google AI Studio | Yes (Get Key) | gemini-2.0-flash-exp, gemini-1.5-pro, gemini-1.5-flash |
| Ollama (Local) | No | llava, gemma3-vision, or any vision model |
| OpenRouter | Yes (Get Key) | google/gemma-2-9b-it:free and 100+ models |
Report Language
Select from 20+ languages for AI-generated reports:
- English, Arabic, Spanish, French, German, Italian, Portuguese
- Russian, Chinese, Japanese, Korean, Hindi, Bengali
- Turkish, Dutch, Polish, Vietnamese, Thai, Indonesian, Persian, Urdu, Swahili
π Usage
Detector Shortcode
Add the plant disease detector form to any page or post:
[plant_disease_detector]
Users can:
- Click to upload an image
- Drag and drop an image
- Paste an image from clipboard (Ctrl+V)
History Shortcode
Display the user's scan history (requires login):
[plant_disease_history]
Features:
- Grid layout with pagination (12 items per page)
- View scan details, descriptions, and treatments
- Delete individual scans
π Project Structure
plant-disease-detector/
βββ assets/
β βββ css/
β β βββ style.css # Main detector styles
β β βββ history.css # History page styles
β βββ js/
β βββ script.js # Detector functionality
β βββ history.js # History page functionality
βββ src/
β βββ Admin/
β β βββ Settings.php # Admin settings page
β βββ Ajax/
β β βββ Handler.php # AJAX request handler
β βββ Api/
β β βββ Client.php # API client factory
β β βββ ProviderInterface.php
β β βββ Providers/
β β βββ GoogleAIProvider.php
β β βββ OllamaProvider.php
β β βββ OpenRouterProvider.php
β βββ Frontend/
β β βββ HistoryPage.php # History shortcode
β β βββ Shortcode.php # Detector shortcode
β βββ History/
β β βββ ScanRepository.php # Scan data access
β βββ PostTypes/
β β βββ ScanPostType.php # Custom post type
β βββ Plugin.php # Main plugin class
βββ vendor/ # Composer dependencies
βββ composer.json
βββ plant-disease-detector.php # Plugin entry point
π Architecture
The plugin follows a modular, object-oriented architecture:
- Provider Interface Pattern β Easily extend with new AI providers by implementing
ProviderInterface - Repository Pattern β
ScanRepositoryhandles all database operations for scans - Singleton Bootstrap β
Pluginclass ensures single initialization - Custom Post Type β Scans stored as
pdd_scanposts with meta for analysis data - PSR-4 Autoloading β Clean namespace structure via Composer
π‘οΈ Security
- All AJAX requests protected with WordPress nonces
- Input sanitization using WordPress sanitization functions
- Output escaping with
esc_html(),esc_attr(), andwp_kses_post() - Capability checks for admin settings (
manage_options) - User-specific scan access control
π Hooks & Extensibility
Filters
// Modify analysis result before saving
add_filter('pdd_analysis_result', function($result, $image_data) {
// Customize result
return $result;
}, 10, 2);
Actions
// After a scan is saved
add_action('pdd_scan_saved', function($post_id, $result) {
// Custom logic
}, 10, 2);
π License
This plugin is licensed under the GPL-2.0-or-later.
π€ Author
Ahmad Wael
Website: www.bbioon.com
Made with π± for plant lovers everywhere