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

feature/DEVSU-2543-auto-image-sizing #414

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

Nithriel
Copy link
Contributor

@Nithriel Nithriel commented Jan 7, 2025

features:

  • Auto image resizing
  • Total size check

@Nithriel Nithriel self-assigned this Jan 7, 2025
Copy link

github-actions bot commented Jan 8, 2025

Unit Test Results

    1 files  ±0    62 suites  ±0   3m 31s ⏱️ +45s
564 tests  - 1  564 ✔️  - 1  0 💤 ±0  0 ❌ ±0 
561 runs   - 1  561 ✔️  - 1  0 💤 ±0  0 ❌ ±0 

Results for commit e64c3df. ± Comparison against base commit 90e990b.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 76.96%. Comparing base (90e990b) to head (e64c3df).

Files with missing lines Patch % Lines
app/libs/createReport.js 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #414      +/-   ##
===========================================
- Coverage    76.96%   76.96%   -0.01%     
===========================================
  Files          179      179              
  Lines         6038     6033       -5     
  Branches       696      696              
===========================================
- Hits          4647     4643       -4     
+ Misses        1314     1313       -1     
  Partials        77       77              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -57,4 +37,6 @@ module.exports = {
MASTER_REPORT_ACCESS: ['admin', 'manager'],
ALL_PROJECTS_ACCESS: ['admin', 'all projects access'],
UPDATE_METHODS: ['POST', 'PUT', 'DELETE'],
IMAGE_UPLOAD_LIMIT: 3000000,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to make these valuables configurable at runtime, with this as the default?


const result = await db.query(
`SELECT
SUM(pg_column_size("reports_image_data")) AS avg_size_bytes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: maybe call this total_bytes

// Process the image (resize and format) and update the size
const resizedImage = await sharp(image.data)
.resize(
Math.floor(image.info.width / 1.5),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we also make the 1.5 configurable?

@@ -72,8 +72,6 @@ router.route('/:template([A-z0-9-]{36})')
data: logo.data,
filename: logo.name,
format: logo.mimetype,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the frontend might need the logo and header to have a specific height and width, @kttkjl can you confirm/deny?

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

Successfully merging this pull request may close these issues.

3 participants