GithubHelp home page GithubHelp logo

ulyssis-kul / compressuploads Goto Github PK

View Code? Open in Web Editor NEW
0.0 6.0 0.0 16 KB

This extension uses various techniques to reduce the size of uploaded files.

License: Other

PHP 100.00%
mediawiki mediawiki-extension imagick ghostscript size-optimization

compressuploads's Introduction

CompressUploads

This extension uses various techniques to reduce the size of uploaded files. Made for ULYSSIS VZW by Joachim Vandersmissen.

Features

  • Compress PDF files using qpdf.
  • Convert inefficient file formats (by default: BMP and TIFF) to PNG files.
  • Compress PNG files using configurable levels and filters.
  • Compress JPG files to configurable quality.
  • Automatically resize images exceeding a maximum width or height (or both).
  • Strip all EXIF data (orientation data will be processed, and ICC profiles are kept).

Installation

  • Install qpdf for PDF compression.
  • Install ImageMagick and Imagick for image processing.
  • Download the latest release, and put the CompressUploads folder in the extensions directory.
  • Add the following to LocalSettings.php:
wfLoadExtension( 'CompressUploads' );

Configuration

As usual, configuration options can be added to LocalSettings.php using global variables.

Option Value Default Value Description
$wgCUCompressPdf boolean true Whether PDF files should be compressed using qpdf. This technique uses PDF Object Streams, which means the compression will have the most effect on PDF files containing a lot of indirect objects.
$wgCUConvertImages String[] ["image/bmp", "image/x-bmp", "image/x-ms-bmp", "image/tiff", "image/tiff-fx"] The MIME types of all inefficient image file formats that should be converted to PNG.
$wgCUPngCompression int 9 The PNG compression level (0-9). This compression is lossless and should not cause any artifacts.
$wgCUPngFilter int 6 The PNG compression filter. For advanced users.
$wgCUJpgQuality int 80 The JPG compression quality (0-100). This compression is lossy: lower quality levels will cause compression artifacts.
$wgCUMaxWidth int 2000 The maximum image width in pixels, larger images will be scaled accordingly. If not set, image width is unlimited.
$wgCUMaxHeight int 2000 The maximum image height in pixels, larger images will be scaled accordingly. If not set, image height is unlimited.
$wgCUStripExif boolean true Whether EXIF data should be stripped from uploaded images.

Tips

  • MediaWiki keeps temporary uploaded files in images/temp/. You could periodically delete these to free up space.
  • MediaWiki keeps deleted uploaded files in images/deleted/. You could delete these, provided you are absolutely sure you won't have to 'undelete' them.
  • The MediaWiki page Special:ListFiles shows every uploaded file on the wiki. These files can be sorted by size to quickly find out which files take up most space.
  • If EXIF data is stripped, metadata such as camera brand, aspect ratio, location is also removed. A win for privacy!

compressuploads's People

Contributors

jvdsn avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

compressuploads's Issues

PNG compression doesn't work

PNG compression doesn't seem to work, due to this issue. Changing setImageCompressionQuality to setCompressionQuality here, solves this issue.

I only tested this on my system (Fedora 37).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.