Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add option to disable resaving of images on upload #3287

Closed
steveooo9 opened this issue Sep 10, 2018 · 4 comments
Closed

Add option to disable resaving of images on upload #3287

steveooo9 opened this issue Sep 10, 2018 · 4 comments
Labels
enhancement improvements to existing features system administration 💼 features related to system administration

Comments

@steveooo9
Copy link

Description

The issue is that some images we have to upload via the CMS backend (no manual FTP upload possible) look not as intended after the resave of an asset after upload. Some clients need perfect images as they were uploaded.

A solution would be adding an option like resaveImagesOnUpload that is set to true as default, but we would have the option to disable the resaving and preserving the real images as it was uploaded. This option should be added for Craft 2.

Additional info

  • Craft version: 2
@brandonkelly brandonkelly added enhancement improvements to existing features system administration 💼 features related to system administration labels Sep 10, 2018
@brandonkelly
Copy link
Member

We considered adding a sanitizeUploads config setting when we were working on #2845, but decided against it because sanitization is only one of the many reasons Craft may need to resave an image on upload. For the setting to be effective you would also need to make the following config changes:

Plus you won’t be able to use the Image Editor or create image transforms, which obviously involve resaving images.

Going to leave this issue open for discussion, but as of right now we don’t know of a good way to implement this feature.

@adamseabrook
Copy link

adamseabrook commented May 27, 2020

We also have significant issues with Craft trying to clean/resave images. By default it also saves them with a lower quality I think.

It was making uploading images very slow as the team had to sit there waiting for it to finish processing an uploaded image. It was also blowing images up from 1.8mb to near 16mb somehow.

#2845 (comment) has some code that can disable the image fiddling. Matt at Servd helped us get it working and it sped up our image upload+saving step significantly. It also stopped the massive blowup in image sizes.

For Craft 3:
in /config/app.php

return [
    'modules' => [
        'my-module' => \modules\Module::class,
    ],
    'components' => [
        'images' => [
            'class' => modules\craft\Images::class,
        ],
    ],
    //'bootstrap' => ['my-module'],
];
  1. In /modules create a new directory called craft
  2. Create a file called Images.php
    add this into it
<?php

namespace modules\craft;

class Images extends \craft\services\Images {

    /**
     * @inheritdoc
     */
    public function cleanImage(string $filePath)
    {
        // no cleansing
    }
}

in general.php add:

		// dont try to compress images again
		'optimizeImageFilesize' => 'false',
		'defaultImageQuality' => '100',
		'maxCachedCloudImageSize' => '0',
		'preserveExifData' => 'true',
		'rotateImagesOnUploadByExifData' => 'false',
		'sanitizeSvgUploads' => 'false',
		'transformGifs' => 'false',
		'upscaleImages' => 'false',

@adamseabrook
Copy link

In addition, if there was an option to disable the image editor we would love to have it. Our images are cropped and compressed in our own editor before we upload them so we just want Craft to display the images as provided. Making sure our team cant accidentally edit them in Craft would be a great option to have.

@andris-sevcenko
Copy link
Contributor

@adamseabrook

In addition, if there was an option to disable the image editor we would love to have it.

There's the Edit images permission for that.

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement improvements to existing features system administration 💼 features related to system administration
Projects
None yet
Development

No branches or pull requests

4 participants