https://github.com/settermjd/mezzio-image-compression
A small repository showing how to do simplistic image compression in PHP
https://github.com/settermjd/mezzio-image-compression
Last synced: about 2 months ago
JSON representation
A small repository showing how to do simplistic image compression in PHP
- Host: GitHub
- URL: https://github.com/settermjd/mezzio-image-compression
- Owner: settermjd
- License: bsd-3-clause
- Created: 2023-05-17T19:06:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T09:23:19.000Z (about 3 years ago)
- Last Synced: 2025-12-26T20:15:02.471Z (6 months ago)
- Language: PHP
- Size: 47.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Mezzio Image Compression
This is a small project showing how to do simplistic image compression in PHP.
## Usage
First, install the project, by running the following command.
```bash
git clone git@github.com:settermjd/mezzio-image-compression.git
```
Then, start the application by running the following command.
```bash
composer serve
```
Then, upload and compress an image by replacing `<>` and `<>` with the path to an image that you want to upload and a name for the file after being uploaded respective, in the command below, before running it.
```bash
curl --silent \
-F image=@<> http://localhost:8080 \
-F file_name="<>" \
-F image_quality="20" | jq
```
You should see output similar to the example below.
```bash
{
"original file": {
"File name": "/var/www/html/data/uploads/Audacity.png",
"File size": 89742,
"File type": "image/png"
},
"new file": {
"File name": "/var/www/html/data/uploads/Audacity.jpg",
"File size": 35958,
"File type": "image/jpeg"
}
}
```