[🐛BUG + Fix🔨] SP Page Builder Media Manager — AVIF files invisible in Folder view - Forum | JoomShaper
Staff replied SP Page Builder

[🐛BUG + Fix🔨] SP Page Builder Media Manager — AVIF files invisible in Folder view

Asked by Brad Thompson 1 month ago Last activity 1 month ago

Component: com_sppagebuilder — Media Manager
Type: Bug
Severity: Medium (workflow disruption)
Environment: Joomla 6, SP Page Builder (latest), PHP 8.x

Summary

AVIF image files uploaded via the SP Page Builder Media Manager appear in the
"All Items" view but are not displayed when browsing folders. This makes
it very difficult to locate AVIF files that have been organized into folders.

Steps to reproduce

  1. Open the SP Page Builder editor and launch the Media Manager.
  2. Upload an .avif image (upload succeeds — AVIF is in the accepted formats
    list).
  3. Confirm the file appears under All Items.
  4. Navigate to the folder the file was uploaded into via the Folders tree.
  5. Observe: the AVIF file is not listed, even though it exists on disk in
    that folder.

Expected behavior

AVIF files should appear in folder browsing view, consistent with the "All
Items" view and with the fact that AVIF is an accepted upload format.

Actual behavior

AVIF files are filtered out of the folder view and cannot be found when
browsing by folder.

Root cause

The Media Manager has two separate data paths:

  • "All Items" reads from the #__spmedia database table (getItems()).
    AVIF rows are inserted on upload, so they appear here.
  • Folder browsing scans the filesystem with
    Joomla\CMS\Filesystem\Folder::files() and a regex extension filter.
    That filter does not include .avif, so AVIF files are filtered out.

The upload code in three locations correctly lists AVIF as an accepted image
format:

  • administrator/components/com_sppagebuilder/editor/traits/Media.php
    (uploadMedia(), line ~187)
  • components/com_sppagebuilder/controllers/media.php
    (upload_media(), line ~360)
  • components/com_sppagebuilder/helpers/ajax.php (line ~795)

But the folder-browsing getFolders() methods do not include .avif in their
Folder::files() filter:

  • administrator/components/com_sppagebuilder/models/media.php (line ~378):
    $items = Folder::files($directory, '.png|.jpg|.jpeg|.gif|.svg|.pdf|.webp', false, true);
  • components/com_sppagebuilder/models/media.php (line ~372):
    $items = Folder::files($directory, '.png|.jpg|.jpeg|.gif|.svg|.pdf|.webp|.srt|.vtt', false, true);

Suggested fix

Add .avif to the filter regex in both getFolders() methods:

  • administrator/components/com_sppagebuilder/models/media.php:
    $items = Folder::files($directory, '.png|.jpg|.jpeg|.gif|.svg|.pdf|.webp|.avif', false, true);
  • components/com_sppagebuilder/models/media.php:
    $items = Folder::files($directory, '.png|.jpg|.jpeg|.gif|.svg|.pdf|.webp|.avif|.srt|.vtt', false, true);

Additional observations

1. Other accepted formats are also missing from the folder filter

The folder filter is missing every video, audio, and most attachment extensions
that are accepted during upload:

  • Video: mp4, mov, wmv, avi, mpg, ogv, 3gp, 3g2
  • Audio: mp3, m4a, ogg, wav
  • Attachment: doc, docx, key, ppt, pptx, pps, ppsx, odt, xls,
    xlsx, zip, json

Only pdf, srt, and vtt from the attachment list are present (and only in
the frontend model). For consistency, the folder filter should include every
extension that the upload code accepts. Otherwise users will hit the same
"uploaded but invisible in folder view" problem for any of these types.

2. AVIF thumbnails are not generated during upload

Independently of the folder-view bug, AVIF thumbnail generation is explicitly
skipped in all three upload code paths via an else if ($ext !== 'avif')
guard around the SppagebuilderHelperImage thumbnail-creation block. As a
result, AVIF rows in #__spmedia have an empty thumb column and empty
media_attr. Even after the folder-view fix is applied, AVIF items may render
without a proper thumbnail in the grid.

We understand this is likely because SppagebuilderHelperImage relies on GD,
and GD AVIF support (IMG_AVIF / imageavif()) is not universally available.
Possible improvements:

  • Detect AVIF support at runtime via function_exists('imageavif') and
    gd_info(), and only skip thumbnail generation when support is absent.
  • Fall back to Imagick when GD lacks AVIF support (Imagick generally supports
    AVIF via libheif).
  • At minimum, set thumb to the original src for AVIF files so the grid
    shows the full-size image as its own thumbnail (as is already done for SVG
    and for small images), instead of leaving thumb empty.

Workaround applied locally

We have patched both getFolders() methods on our site to add .avif to the
filter regex. This patch must be re-applied after every SP Page Builder
update until the fix is released upstream.

1 reply

Paul Frankowski Senior Staff

Hi Brad,

Thanks, noted and shared with our developer as suggestion for next 6.8.1+

Log in to reply.