adaptlearning / adapt_authoring

A server-based user interface for authoring eLearning courses using the Adapt framework.
https://www.adaptlearning.org/
GNU General Public License v3.0
520 stars 287 forks source link

Support compressing images with tinypng/similar #2435

Open moloko opened 5 years ago

moloko commented 5 years ago

Affected Area

Asset management/publishing

Requested Feature

Support being able to use tinypng to compress images, either via the asset management (compress all images) or when publishing a project (just images used by the project)

Use Case

Currently if un- or poorly-compressed images are added to an AAT instance, the effort required to track them down, re-compress and re-upload is quite high. Adding an option to being able to setup tinypng within the AAT would allow this to be done really easily.

Current Workaround

None really, has to be done manually

Additional Information

Tinypng nodejs API documentation: https://tinypng.com/developers/reference/nodejs As it requires an authentication key, it would be necessary to allow an admin to configure this in the AAT somewhere. It would be necessary to display the current compression count somewhere - tinypng is a 'freemium' service so it will be necessary for content authors to be able to see how many compressions they have available.

Link2Twenty commented 5 years ago

TinyPNG uses https://pngquant.org/, which is open source, provided people don't mind their server doing some extra crunching during the build we should be able to include pngquant directly. https://www.npmjs.com/package/pngquant or https://www.npmjs.com/package/imagemin-pngquant

moloko commented 5 years ago

@Link2Twenty I think a free solution that can be encapsulated in the tool is definitely the better way to go if possible. It might be nice to also have a 'connect to tinypng' option - but better to focus on something that won't cost content authors to use and that can be built into the AAT

I also found this whilst looking into pngquant https://github.com/imagemin/imagemin - seems to have support for tools specific to jpeg, webp and svg optimisation as well