Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
9 Feb 2025

Summary of Changes

The changes allows thumbnail for any file type: video, pdf, audio etc.

Testing Instructions

Apply path, run npm install.
Edit

if (!$isDir && MediaHelper::isImage($obj->name)) {

And add following else condition (optionaly change the image path):

else {
  if (!$isDir){
    $obj->thumb_path = Uri::root(true) . '/images/headers/raindrops.jpg';
  } else {  
    $obj->thumb_path = Uri::root(true) . '/images/headers/maple.jpg';
  }
}

Go to media manager and upload some video, or audio or any other file.
Thn check the thumbnail.

Actual result BEFORE applying this Pull Request

Non image files has a icon

Expected result AFTER applying this Pull Request

Non image files has a 'raindrops.jpg' image

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: TBD
  • No documentation changes for manual.joomla.org needed
avatar Fedik Fedik - open - 9 Feb 2025
avatar Fedik Fedik - change - 9 Feb 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Feb 2025
Category Administration com_media NPM Change Repository
avatar Fedik Fedik - change - 9 Feb 2025
The description was changed
avatar Fedik Fedik - edited - 9 Feb 2025
avatar brianteeman
brianteeman - comment - 10 Feb 2025

Maybe I am missing something but I am missing the usecase for this and how it can be used by a siteowner without core hacks

avatar Fedik
Fedik - comment - 10 Feb 2025

No need core hacks, what you see in the description is for testing only.

The use case:

  • 3rd filesystem plugins could add thumbnail for their files (I curently need it for video thumbnail for personal project)
  • 3rd plugin could add thumbnail to existing files while listening onFetchMediaItems :
public function onFetchMediaItems($event)
{
  $items = $event->getArgument('items');

  foreach ($items as $item) {
    if (in_array($item->extension, ['mp4', 'mp3', 'pdf'])) {
      $item->thumb_path = Uri::root(true) . '/images/headers/raindrops.jpg';  
    }
  }

  $event->setArgument('items', $items);
}

Add a Comment

Login with GitHub to post a comment