apostrophecms / apostrophecms/apostrophe

2.x Uploaded image increases in size and ignores image: false

Open
#3,180 22 comments 0 reactions 0 assignees View on GitHub
bug enhancement help wanted
Dominant language
JavaScript
Stars
4.6k
Forks
650
Avg merge
19h 21m
Merged PRs (30d)
23

Description

## To Reproduce
Upload any image file through the Apostrophe UI.

## Expected behavior

I would like to upload image files without any modifications, optimisations or compressions. I would like to eventually use it as follows: `{{ apos.attachments.url(data.widget._backgroundImage.attachment, { size: 'original' }) }}`

## Describe the bug
However, when I upload a 300KB JPG file, I get the "original" file with 1.7MB in size.

## Details

**Version of Node.js:**
v14.17.0

**Server Operating System:**
MacOS Catalina

**Additional context:**

`apostrophe-attachments` configuration
```
'apostrophe-attachments': {
svgImages: true,
fileGroups: [
{
name: 'images',
label: 'Images',
extensions: ['png', 'gif', 'jpg', 'svg'],
extensionMaps: { jpeg: 'jpg' },
image: false
},
```

👆 Notice that there is `image: false`, so it should not treat it as an image and hence not created scaled versions of the file.

I am not using ImageMagic – I am going to try and give an update if it helps.

**Screenshots**
Original file:
Screenshot 2021-06-17 at 15 14 43

File on the server (with the scaled image versions too):
Screenshot 2021-06-17 at 15 14 59

Contributor guide

Open the contributing guide

Research direction

Start with the apostrophe-attachments configuration and the upload path that handles the `image: false` option. Reproduce the upload using a JPG and the `size: 'original'` URL, then verify that the original file is unchanged and that scaled image versions are not created when image processing is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.