Skip to content

MediaManagerFiles — Media Manager for Non-Image Files

Extension for Magento 2

User Manual


CopeX GmbH
Web: https://copex.io
Email: office@copex.io


Table of Contents

Section Page
1 Requirements 2
2 Configuration 2
3 Features 2
3.1 PDF Support in the CMS Media Manager 2
3.2 PDF Preview in the Media Gallery 3

1 Requirements

  • Magento 2.3 or higher (compatible with 2.4)
  • PHP 8.1 or higher

2 Configuration

This module has no backend configuration. It is active immediately after installation.


3 Features

3.1 PDF Support in the CMS Media Manager

Standard Magento tries to process every uploaded file as an image. For non-image files like PDFs, this resize process fails with an error.

This module solves the problem through a plugin that intercepts the resize process:

  • When resizing a file throws an error (e.g. for PDFs, DOC files, or other non-image formats), the plugin intercepts and returns a default placeholder image instead.
  • The error is not forwarded to the user; the upload process completes successfully.
  • PDFs and other non-image files can therefore be uploaded and used without issue through the Magento WYSIWYG editor (e.g. in CMS pages and blocks).

In addition, the allowed file extensions in the media manager are extended to include pdf, so PDF files are not blocked by the upload filter.

When displaying files in the Magento media gallery (Content > Media), PDFs are shown with a dedicated PDF icon instead of the default placeholder image.

The PDF icon (/wysiwyg/pdf-icon.png) is automatically used for all files with the .pdf extension. Other file types retain their default preview behavior.

Flow when uploading a PDF file:

  1. Administrator opens the WYSIWYG editor in a CMS page or block.
  2. Administrator clicks "Insert Image" and opens the media manager.
  3. PDF file is uploaded.
  4. The module prevents the failing resize attempt.
  5. The PDF file appears in the media manager with the PDF icon.
  6. The administrator can insert the PDF file as a link in the CMS page.

License

Proprietary — CopeX GmbH. One license per production Magento instance. Test and development environments do not require an additional license.