Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD extension latest version support #192

Open
mhetreramesh opened this issue Mar 17, 2021 · 13 comments
Open

GD extension latest version support #192

mhetreramesh opened this issue Mar 17, 2021 · 13 comments

Comments

@mhetreramesh
Copy link

I use a lambda function to generate images backed by bref. Internally I've used gd library & gd lambda layer.

Functionally, everything works fine but there is a difference between generated image on lambda function & local. I did a more detailed investigation & found out that the gd library version on production is different than local. I suspect that can be the issue in my case.

Local docker GD version

image

Bref lambda production GD

image

I was trying to look into a way to upgrade GD library version, it would be great if I get some directions. I'll try to send a PR.

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 18, 2021

How do you build your local docker image? What version of this library are you using in production?

Here is everything related to the GD extension: https://github.com/brefphp/extra-php-extensions/blob/master/layers/gd/Dockerfile

@mhetreramesh
Copy link
Author

I've used laravel sail for local environment.

Below are the Bref versions I have on production:

image

I went to this GD extensions dockerfile but did not found a way how I can change the gd version from 2.1.0 to 2.3.0

Am I missing something?

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 18, 2021

There are a two strange things I see:

  1. You are using two very different docker images for local and for production.
  2. You are not using the latest release of bref/extra-php-extension.

Why did you expect them both to use the same version of GD?


The GD extension is bundled with PHP. See https://www.php.net/manual/en/extensions.membership.php

We may need to install the libgd and use that library (over the bundled one) when doing configure. Version 2.3.1 was released 2021-01-30.

@mhetreramesh
Copy link
Author

Yes, I use two different docker images. That was the quickest way I got started with both development & production working. Then later I've realized the gd version difference(sorry for creating confusion by posting my development environment details, I wanted to share my reason to upgrade gd). Then I started looking how I can upgrade GD version for bref, did found this bundled process complicated & ended up creating this ticket.

Now, do you know how can we use PHP bundled GD here?

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 18, 2021

Now, do you know how can we use PHP bundled GD here?

We are using the bundled PHP GD. If we want to update the version we need to use an external GD lib.

I tried to use --with-external-gd but Im out of luck.

Maybe @shouze could help?

@shouze
Copy link
Contributor

shouze commented Mar 18, 2021

@mhetreramesh I'm not sure but maybe you can try to upgrade to bref 1.2.1 and get lucky for a bundled gd upgrade.

If not, I guess that we can ask @mnapoli to push up to date bref docker build images (at least 1.2.0 or 1.2.1) that we could also use as base images to build gd ext in this repo.

@shouze
Copy link
Contributor

shouze commented Mar 18, 2021

@mhetreramesh also, could you please give the name of your local laravel sail base image used for local development? Anyway I guess it's not a very good option to use it and prefer instead using official bref images if you want to be in sync on every php points (php versions, ext versions, php settings) and avoid a lot of surprises over time between local development and your deployments envs.

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 18, 2021

What feature in GD 2.3.0 are you using that does not exist 2.1.0? Ie, why is the update needed?

@mhetreramesh
Copy link
Author

What feature in GD 2.3.0 are you using that does not exist 2.1.0? Ie, why is the update needed?

To be honest, I exactly don't know if the GD version is the root cause of my problem. I am using intervention/image to manipulate images(Adding different layers on images). I saw a visible difference in the generated images on local vs production(the production version is buggy). Then I looked into configuration difference & found out that GD version difference is the only thing which seems to be a big difference, so I thought of updating it.

@mhetreramesh
Copy link
Author

@mhetreramesh also, could you please give the name of your local laravel sail base image used for local development? Anyway I guess it's not a very good option to use it and prefer instead using official bref images if you want to be in sync on every php points (php versions, ext versions, php settings) and avoid a lot of surprises over time between local development and your deployments envs.

The local sail image is FROM ubuntu:20.04, here is gist of sail dockerfile

Going with the sail for local dev environment was easy start back then, but now I've realized to spend more time making proper dev setup which is using bref docker images.

I've tried updating to latest bref version, no luck with that.

@mhetreramesh
Copy link
Author

This is the noticeable difference I have with generated images:

Production version:

image

Local version(expected behavior):

image

@Nyholm
Copy link
Collaborator

Nyholm commented Mar 23, 2021

Using bref/build-php-7.4:1.2.3 will still generate version 2.1.

@mhetreramesh
Copy link
Author

Update:

I tried with the recent versions of my all packages from bref & this issue seems to be still existing. I'm sure the latest GD version will be used in bref soon in the mean time I've moved my that specific service back to EC2 traditional way.

As soon as the update is there, I'll move back to Lambda again.

Thanks for your help! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants