Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] Media: allow thumbnail for any file type #44847

Open
wants to merge 5 commits into
base: 6.0-dev
Choose a base branch
from

Conversation

Fedik
Copy link
Member

@Fedik Fedik commented Feb 9, 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:

Sorry, something went wrong.

@joomla-cms-bot joomla-cms-bot added NPM Resource Changed This Pull Request can't be tested by Patchtester PR-5.3-dev labels Feb 9, 2025
@Fedik Fedik added the Feature label Feb 9, 2025
@brianteeman
Copy link
Contributor

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

@Fedik
Copy link
Member Author

Fedik commented Feb 10, 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);
}

@martin-zw
Copy link

I have tested this item ✅ successfully on 242a656


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44847.

1 similar comment
@viocassel
Copy link
Contributor

I have tested this item ✅ successfully on 242a656


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44847.

@QuyTon
Copy link
Contributor

QuyTon commented Feb 27, 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44847.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 27, 2025
@laoneo
Copy link
Member

laoneo commented Feb 28, 2025

Can this somehow be documented?

@Fedik
Copy link
Member Author

Fedik commented Feb 28, 2025

I will write something after it will be merged.

@laoneo
Copy link
Member

laoneo commented Feb 28, 2025

Better would be the opposite, so it will no get forgotten.

@Fedik
Copy link
Member Author

Fedik commented Feb 28, 2025

I mean, I can write doc, but then waiting another year for merging, not much fun and motivating.
If it not going to be merge in this release, then I see no reason to spend my time for docs ASAP.

@richard67
Copy link
Member

richard67 commented Feb 28, 2025

@Fedik Sorry, it seems my suggested javascript code style changes were not sufficient. Now the javascriptcs checker complains about missing line breaks and indentation: https://ci.joomla.org/joomla/joomla-cms/82743/1/20

@Fedik
Copy link
Member Author

Fedik commented Feb 28, 2025

No problem, I also can fix them later, if it fail again.
But thanks for checking ;)

@rdeutz rdeutz changed the base branch from 5.3-dev to 6.0-dev February 28, 2025 11:56
@rdeutz rdeutz self-requested a review as a code owner February 28, 2025 11:56
@rdeutz rdeutz changed the title [5.3] Media: allow thumbnail for any file type [6.0] Media: allow thumbnail for any file type Feb 28, 2025
@rdeutz rdeutz removed the PR-5.3-dev label Feb 28, 2025
@softforge
Copy link
Contributor

Hi @Fedik I am happy to merge this once we have the documentation. You will not need to wait, if you fix the conflicts then ping me I am getting regular tests on a Friday and it can be tested and merged

@Fedik
Copy link
Member Author

Fedik commented Feb 28, 2025

The conflicts should go away after next upmerge 😉

Fedik and others added 5 commits March 1, 2025 12:26

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@Fedik
Copy link
Member Author

Fedik commented Mar 1, 2025

Okay, had to redo "rebase" localy, because automatic one went wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature NPM Resource Changed This Pull Request can't be tested by Patchtester PR-6.0-dev RTC This Pull Request is Ready To Commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants