Closed EduardoDePatta closed 1 week ago
Thank you @EduardoDePatta, I'm on vacation until 9th September, after that I'm going to have a look!
@EduardoDePatta This looks very solid! I tweaked structure to be more aligned with other tools in latest commit. Also, I added max height for preview image since it can happen that users upload vertical screenshot (from mobile)
I left few minor comments for you to address.
This is the preview of updated UI / structure:
@EduardoDePatta I also noticed that tests are failing for Image resizer
FAIL components/utils/resize-image.utils.test.ts (10.528 s)
@EduardoDePatta I also noticed that tests are failing for Image resizer
FAIL components/utils/resize-image.utils.test.ts (10.528 s)
@peckz the test likely failed because the canvas
package is not installed as a dev dependency. Since jsdom doesn't fully support .toDataUrl
, the canvas package is required to simulate this behaviour in a node.js environment using jest.
Installing the necessary dependencies should resolve the issue.
Aside from that, all the other corrections have already been made!
@EduardoDePatta Thanks for resolving conflicts!
I'm having issues with npm install
. I've run into this before with node-canvas
package.
From their repo:
Compiling If you don't have a supported OS or processor architecture, or you use --build-from-source, the module will be compiled on your system. This requires several dependencies, including Cairo and Pango.
For detailed installation information, see the wiki. One-line installation instructions for common OSes are below. Note that libgif/giflib, librsvg and libjpeg are optional and only required if you need GIF, SVG and JPEG support, respectively. Cairo v1.10.0 or later is required.
I might need to update README.md with additional steps.
Which OS are you using Windows, Linux, Mac?
Are you using node 20.9.0
@peckz I tested it on both Ubuntu 22.04.3
and Windows 10
, without npm cache and with node 20.9.0
and everything worked fine! I wasn't able to reproduce the issue you reported. If it's possible to identify where the problem occours, we could create a postinstall script with uname
or something similar to add the necessary dependencies for specific environments.
@EduardoDePatta Thanks for info! I think in general, the problem is with MacOS and arm architecture.
Our pipeline is running npm install
successfully on linux-x64 node-20.9.0-linux-x64.tar.gz
Those libs are necessary to install on MacOS:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python-setuptools
I'm going to merge this and update README.md
Thank you for the contribution!
Hello again!
This PR introduces a new
Image Resizer
page that allows users to resize images in PNG, JPEG, and SVG formats. Supports aspect ratio maintenance, and quality adjustments(jpeg).Key Changes
Utility Functions:
New Component:
Test Suite:
Updated Tools List:
Documentation update:
Benefits
OBS:
canvas
in devDependenciesI also considered adding the functionality to crop images, but since this PR is already QUITE LARGE due to the extensive test file, the addition of dependencies, and the refactoring of the image upload component to make it reusable, SEO component, etc, I decided to leave that as a separate task, should this one be approved.