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

PHP: Add libjpeg and libwebp support #1393

Merged
merged 9 commits into from
May 17, 2024
Merged

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented May 14, 2024

Adds libjpeg and libwebp support to kitchen-sink and node.js builds.

All PHP versions got libjpeg, but only PHP >= 7.4 got libwebp. Getting it to work on 7.0 – 7.3 will require additional explorations.

Related to #1381 and #1175.

Testing instructions

  • Confirm the CI tests pass
  • Go to /phpinfo.php on your local dev server and confirm it lists jpeg and webp support in the "GD" section

Related to #1381
and #1175.

Ships WASM builds og libjpeg and libwebp. This PR doesn't include them
in the PHP build yet, only ships pre-build wasm binaries. It might
require further tweaking before they can be included in the GD build.
@adamziel adamziel changed the title Ship WASM builds of libjpeg-turbo and libwebp WASM builds of libjpeg-turbo and libwebp May 14, 2024
@sejas
Copy link
Collaborator

sejas commented May 15, 2024

Thanks for working on this 🙏 .

@adamziel
Copy link
Collaborator Author

It works for PHP 7.4 – it needs rebuilding all the kitchen sink and node versions of PHP and double-checking the uploads. I might not be able to get this to completion this week – @sejas would you like to take over from here?

CleanShot 2024-05-16 at 00 03 13@2x

@adamziel
Copy link
Collaborator Author

I found some time to rebuild the wasm files, let's see if the tests pass and ship

@adamziel
Copy link
Collaborator Author

It doesn't seem like it worked for the older PHP versions, I think they need different compilation flags

@adamziel
Copy link
Collaborator Author

adamziel commented May 17, 2024

I couldn't get libwebp to work for PHP <= 7.3 – the compiler complained about libwebp not being compiled with -fPIC even after I did compile it with those flags. 🤷 This PR, thus, ships libjpeg for all PHP versions, but libwebp only for PHP >= 7.3. Let's ship it as it is – we may always iterate on webp support later on.

@adamziel adamziel merged commit 51d1d88 into trunk May 17, 2024
5 checks passed
@adamziel adamziel deleted the compile-libjpeg-libwebp branch May 17, 2024 14:32
@adamziel adamziel changed the title WASM builds of libjpeg-turbo and libwebp PHP: Add libjpeg and libwebp support May 17, 2024
@sejas
Copy link
Collaborator

sejas commented May 20, 2024

It works for PHP 7.4 – it needs rebuilding all the kitchen sink and node versions of PHP and double-checking the uploads. I might not be able to get this to completion this week – @sejas would you like to take over from here?

CleanShot 2024-05-16 at 00 03 13@2x

Thanks again for working on this until completion. 🙌
Recompiling the PHP code to our needs is super awesome. Thank you!

@derekblank
Copy link
Member

derekblank commented May 21, 2024

Thank you for addressing! 🙏 This change should resolve the issue of WebP support in Studio by pointing to a new release of the @php-wasm/node package with these changes. Anything that can be done from our end to help support a new release? (I'm not entirely sure if the @php-wasm/node package can be released independently of a full WordPress-Playground release.)

Edit: php-wasm/node has been released with v0.7.20 https://www.npmjs.com/package/@php-wasm/node 👍 🙇

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

Successfully merging this pull request may close these issues.

None yet

3 participants