GlassyPic — AI Image Optimization
Glassypic for WordPress — AI image optimization plugin
by GlassyPic · github.com/onepunchtechnology/glassypic-wordpress · 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/onepunchtechnology/glassypic-wordpress/archive/refs/heads/main.zipGlassyPic — AI Image Optimization for WordPress
GitHub account:
onepunchtechnology. company (One Punch Technology) repo. Rungh auth switch --user onepunchtechnologyonce at the start of any session and stay on it for allgh/git pushwork — do not switch back to a personal account mid-session.
WordPress plugin for GlassyPic — a four-stage AI image optimization pipeline: upscale (Real-ESRGAN), resize, perceptual compression, and auto-generate SEO alt text. Runs in the background via ActionScheduler.
For installation instructions, feature descriptions, and FAQ see the WordPress.org plugin listing (coming soon) or
readme.txt.
Development
Requirements: PHP 8.1+, Composer
composer install # install dependencies
composer test # run PHPUnit with --testdox
# Lint
./vendor/bin/phpcs --standard=phpcs.xml.dist src/ uninstall.php
# Auto-fix style
./vendor/bin/phpcbf --standard=phpcs.xml.dist src/ uninstall.php
# Run a single test class
./vendor/bin/phpunit --filter ProcessorTest
# Run a single test method
./vendor/bin/phpunit --filter 'ProcessorTest::test_run_saves_results_on_success'
Tests use PHPUnit 10 + Brain\Monkey (Mockery-backed WordPress function stubs) — no live WordPress install required.
Architecture
glassypic.php bootstraps on plugins_loaded and calls Plugin::init(), the single wiring point for all WordPress hooks. No hooks are registered outside of Plugin.
Processing pipeline
Upload event
└─ Scheduler::queueOnUpload() wp_generate_attachment_metadata filter
└─ ActionScheduler job
└─ Processor::run()
├─ ApiClient::upload() → temp_file_id (3 retries)
├─ ApiClient::process() → job_id
├─ ApiClient::pollJob() → polls every 3s, max 5 min
├─ ApiClient::downloadProcessedFile()
├─ Replacer::swap() → atomic copy+rename, .glassypic-orig backup
├─ MetaManager::saveResults() → _glassypic_* meta, status=completed
└─ Processor::optimizeThumbnails() → opt-in, non-fatal
Status lifecycle
(none) → pending → processing → completed
→ failed
→ paused (credits exhausted; auto-resumes)
All status is stored in _glassypic_* attachment post meta, managed exclusively by MetaManager.
Key gotchas
- Re-entrant guard:
Replacer::swap()callswp_generate_attachment_metadata()to regenerate thumbnails, which re-fires the upload filter.Scheduler::queueOnUpload()returns early if status is alreadypending,processing, orcompleted. - Poll resume: a
PollTimeoutExceptionleavesjob_idintact so the nextProcessor::run()call skips upload+process and resumes from polling. - API key encryption: AES-256-CBC using
AUTH_KEY . SECURE_AUTH_KEYas key material; never output in plaintext.
Debugging
Check the ActionScheduler queue:
/wp-admin/tools.php?page=action-scheduler&s=glassypic