Image compression is the one Z Tools workflow that intentionally crosses the browser/server boundary. That makes the implementation details—limits, temporary storage, codec support, cleanup, and download authorization—part of the product value, not boilerplate hidden in a privacy page.
What happens after you choose a file
- The server validates the upload and enforces the current 10 MiB / 12.5 megapixel bounds.
- The file is placed under a session-bound temporary path with a randomized name rather than a user-controlled public filename.
- PHP GD decodes and re-encodes the supported image using bounded resource/concurrency guards.
- The result is served through the download proxy only after session/filename/expiry/HMAC checks.
- Temporary image files are cleaned within 5 minutes; download URLs expire earlier when the flow requires it.
What the current controlled fixture measured
The current run used PHP 8.3.6 with GD, JPEG, PNG, and WebP support. On the bundled deterministic 1200×800 gradient/noise fixture, the script records these representative output sizes and savings against a same-format baseline:
| Format/setting | Baseline | Output | Saved |
|---|---|---|---|
| JPEG quality 75 | 1,606,187 B | 152,036 B | 90.53% |
| PNG compression 9 | 2,885,501 B | 16,118 B | 99.44% |
| WebP quality 75 | 295,832 B | 116,624 B | 60.58% |
These are fixture-specific measurements, not universal compression promises. The raw JSON includes every tested setting, codec availability, baseline bytes, output bytes, and savings calculation.
What should be measured on the production host
Run the provided PHP script on an environment with the same GD codecs as production and retain the raw result file before making production-specific performance claims. Then add representative photographic, screenshot, graphic, and transparency fixtures—not just a synthetic gradient—because formats behave differently across content types.
JPEG, PNG, WebP: choose by content
- JPEG: strong for photographs; quality is lossy and should be judged visually at intended display size.
- PNG: lossless and useful for crisp graphics/transparency, but photographic PNGs can be unnecessarily large.
- WebP: can support both lossy and lossless workflows; whether it is the best output depends on source content and server codec support.
Why “quality 80” is not a universal rule
Quality sliders are codec-specific controls, not perceptual percentages. Two encoders at “80” can produce different sizes and artifacts. The safe workflow is: choose a target display dimension, test a few quality settings, compare visible detail around edges/text/gradients, and record the actual bytes.
Privacy and shared-hosting constraints
Server processing consumes CPU, memory, upload bandwidth, and PHP workers. The current implementation uses conservative file/dimension limits and concurrency guards because the deployment target is a shared-hosting environment. That is also why Z Tools does not expose public stress tests or unlimited batch compression.