Batch optimize existing images (File entities)

Created on 31 October 2024, about 2 months ago

Problem/Motivation

Thank you very much for this great module! It offers wonderful functionality for image actions and for uploads!

The last missing piece, I think, is being able to optimize existing images. This is important for projects with already many many source images that are simply unoptimized.

In this case it totally makes sense to optimize them already at source level to save space, computing power and transfer.

Maybe it would make sense to add an action / bulk operation on file entities, so that these can be selected in a bulk edit view to be processed?

We'd like to help to implement this, but would be great to have some maintainer feedback first!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇭🇺Hungary tikaszvince

    It is not scope of this module to batch process existing images.

    There are plenty of solutions for bulk process files, which you can find here: https://tinypng.com/third-party#development

  • 🇩🇪Germany Anybody Porta Westfalica

    Hi @tikaszvince thank you very much for your quick reply. Sadly the link isn't helpful enough for Drupal, as Drupal stores metadata like file size and formats (and eventually even checksum, I'm not currently sure) in the database. So you should not simply batch-process existing files on the server without bulk-updating that metadata.

    For that reasons it would make a lot of sense to add an action to do that in Drupal on file entities.

    Of course I'm not asking you to do that as maintainer, we're happy to help and provide the MR.

  • 🇭🇺Hungary tikaszvince

    You request to make possible to modify the previously uploaded files. Anything can go wrong during the TinyPNG API communication.
    And if an error is not handled, or if we overwrite an existing file with incorrect data it can lead to data loss.

    I cannot take responsibility for this possibilities, so even if the patch or MR will be created that will be no part of this module.

    I suggest to create a separated module to implement this feature.

  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @tikaszvince. I have to accept that. Still I don't totally understand that point, because we could warn about that risk and do nothing, if anything (we can detect) goes wrong.

    Furthermore you already have a feature to optimize uploaded images on upload. Same can happen there...

    But yes of course, it's your module and you decide.

Production build 0.71.5 2024