Thumbgun Symfony application
A Symfony application that in response to a specific GET request:
- retrieves the image from the configured data storage,
- resizes the image on the fly,
- outputs the image in the requested output format.
Installing locally
@see #1 Dockerizing the Symfony 6 app
- Add
thumbgun.local
to thehosts
of your system - Copy
.env.dist
to.env
and modify whichdocker-compose.yml
files to use - Copy
app/.env.local.dist
toapp/.env.local
and modify accordingly - Run
docker-compose up -d
(docker-compose down
if you have any issues) - Install vendors
docker-compose exec php composer install
- Open
http://thumbgun.local
Stopping
docker-compose down
Are you working in Linux? Fix permission issues
@see #1 Dockerizing the Symfony 6 app
- Copy
docker-compose.custom.yml.dist
todocker-compose.custom.yml
- Change
USER_UID
andUSER_GID
to your user's id and group id - Include this custom docker-compose file in the
COMPOSE_FILE
of the.env
file
Xdebug
To enable:
- Make sure
docker-compose.xdebug.yml
is included in theCOMPOSE_FILE
of your.env
- Add server in PHPStorm named
xdebug
and map theapp/
directory to the/var/www/html
- Use xdebug extension in the browser to start the session. To run a command with debugger
enabled, use the xdebug wrapper in the container, eg.
xdebug bin/console some:command
To disable:
- Make sure
docker-compose.xdebug.yml
is not included in your.env
Configuring AWS S3 access
- Create a policy in the AWS IAM console to grant access to the to the S3 bucket containing your images
- Create a programmatic user in the AWS IAM console with the policy above attached to it and store the credentials
- Copy the
app/.env.local.dist
toapp/.env.local
and modify the values
Example IAM policy granting only read access to a bucket:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}
Generating image url
CLI tool is available to generate image link, eg:
docker-compose exec php bin/console dev:url fixed 100x100 some/file/id.jpg webp
will output:
/t/r87mc0861cc/fixed/100x100/webp/some/file/id.jpg