#Image resize doesn't work

26 messages · Page 1 of 1 (latest)

fierce owl
#

I am trying to resize new images on upload, so that client's photos get downsized to a max width of 2000px.

What I'm doing wrong?

upload: { staticURL: '/media', staticDir: 'media', mimeTypes: ['image/*'], disableLocalStorage: true, resizeOptions: { width: 2000, kernel: 'nearest', fit: 'cover', position: 'entropy', withoutEnlargement: true, }}

On the admin ui the size and weight is correct but on server is uploaded like the original

#

Admin ui after upload

#

Image size on server

vapid geyser
#

Let me see if I can recreate

#

This works for me. I uploaded a 317kb file and the result was 116 bytes (20px width).

#
    resizeOptions: {
      width: 20,
      kernel: 'nearest',
      fit: 'cover',
      position: 'entropy',
      withoutEnlargement: true,
    },
#

Are you using any plugins? I see you have disableLocalStorage: true

fierce owl
#

plugins: [cloudStorage({ collections: { media: { adapter: adapterGCS } } })],

#

const adapterGCS = gcsAdapter({ options: { keyFilename: './src/util/*.json', }, bucket: process.env.GCS_BUCKET, });

#

I have tried so many times

#

On the server still che original image

vapid geyser
#

Okay, this info helps

fierce owl
#

Even when clicking on the image title on che admin ui
I get che full image

vapid geyser
#

Let me take a quick look on how the plugin may treat resizing differently

#

I'm going to log this as a possible bug @fierce owl . This will take some investigating.

fierce owl
#

Thank you 💪

frail forge
#

this is happening to me as well, the size and image dimensions are shown in the admin, but when I go to the S3 the original image is uploaded,

the only thing that has worked for me is converting from png to jpg, but resizing and shrinking doesn't work

vapid geyser
#

Let me take a look into this today

#

@frail forge What version of Payload are you on? This appears to be working fine on my end.

frail forge
#

I am on lastest version 1.6.3

vapid geyser
#

Can you post your config? It sounds like this is working as expected. Payload will always upload the original file.

#

You have the option of doing a resize on the original as well within your config

frail forge
#

this is my payload.config.ts

      collections: {
        // Enable cloud storage for Media collection
        assets: {
          disableLocalStorage: true,
          // Create the S3 adapter
          adapter: s3Adapter({
            config: {
              region: process.env.AWS_REGION,
              credentials: {
                accessKeyId: process.env.S3_ACCESS_KEY_ID,
                secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
              },
            },
            bucket: process.env.S3_BUCKET,
          }),
        },
      },
    }),```


I understand what you say that it will always store the original file but it doesn't store the resized file, is it stored somewhere else?
vapid geyser
#

The original file will be resized according to the upload.resizeOptions property. Resizing for other specific sizes happens within the imageSizes array. Is this how your upload config on the collection is configured?