question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
boutellcommented, Jul 6, 2021

copyOriginal and orientOriginals would need to be nested inside an “uploadfs” sub-option.

I would not recommend “copyOriginal: false” because it would have the surprising result of preventing Apostrophe from ever rescaling if you add more sizes or make crops with the UI later etc. It’s an uploadfs feature but not one that is recommended for Apostrophe.

On Tue, Jul 6, 2021 at 10:28 AM stepanjakl @.***> wrote:

Exactly how are you configuring apostrophe-attachments? … <#m_-3594264285669919598_>

[image: Screenshot 2021-07-06 at 15 27 14] https://user-images.githubusercontent.com/47005900/124617263-b470eb00-de6e-11eb-9a97-6b69d96f894e.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe/issues/3180#issuecomment-874809967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27JM7PVTGUZSPIM2CXDTWMHHVANCNFSM464CRAVA .

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

1reaction
boutellcommented, Jun 30, 2021

TIL (Today I Learned): modern browsers apparently do support exif rotation hints by default. IE11 does not however, and is still unfortunately supported by some projects at least into 2022 when Microsoft will stop supporting it.

I’m not crazy though, this is very recent (2020, for Chrome):

https://www.chromestatus.com/feature/6313474512650240

https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation#browser_compatibility

On Tue, Jun 29, 2021 at 12:10 PM stepanjakl @.***> wrote:

@boutell https://github.com/boutell Really, images don’t work without the autorotation on the web? I have never heard about it. There was never a need for me to update any metadata to use on the web.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe/issues/3180#issuecomment-870731870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27P4PD7RXJTVLII3ZBLTVHWAXANCNFSM464CRAVA .

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Height And Width On Images Is Important Again
To prevent layout shifts and improve performance scores, we need to always set width and height attributes on our images.
Read more >
Next.js automatic image optimization with next/image
Learn about automatic image optimization and how it can benefit developers with the native, game-changing, and powerful next/image API.
Read more >
Image data loading - Keras
image_size: Size to resize images to after they are read from disk, specified as (height, width) . Defaults to (256, 256) . Since...
Read more >
Basic Features: Image Optimization - Next.js
Faster Page Loads: Images are only loaded when they enter the viewport, with optional blur-up placeholders; Asset Flexibility: On-demand image resizing, even ...
Read more >
Image Processing with Python - Data Carpentry
While we will deal with pictures of such complexity shortly, let's start our exploration with 15 pixels in a 5 X 3 matrix...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found