Conflicting Files ? NPM Resource Changed ? Maintainers Checked Pending

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
29 Nov 2020

Summary of Changes

When creating a 3rd party filesystem plugin and selecting an image in a media file selection (e.g. in the article form view), the image will not be displayed, because the variable is wrong.

Testing Instructions

Actual result BEFORE applying this Pull Request

  • Image not selected/displayed

Expected result AFTER applying this Pull Request

  • Image selected/displayed

@dgrammatiko perhaps you can check?

avatar bembelimen bembelimen - open - 29 Nov 2020
avatar bembelimen bembelimen - change - 29 Nov 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Nov 2020
Category JavaScript Repository NPM Change
avatar bembelimen bembelimen - change - 29 Nov 2020
The description was changed
avatar bembelimen bembelimen - edited - 29 Nov 2020
avatar dgrammatiko
dgrammatiko - comment - 29 Nov 2020

Is thump_path always the same as the url? If so then remove it in the Media manager Api, but I think that thump is for a thumbnail provided by some cloud storage providers (s3, dropbox)

avatar bembelimen
bembelimen - comment - 29 Nov 2020

Is thump_path always the same as the url? If so then remove it in the Media manager Api, but I think that thump is for a thumbnail provided by some cloud storage providers (s3, dropbox)

No, but that is not the fix here. Thumbpath is for non local adapters. This fix is the call, when someone either insert an image into the editor (via the image plugin) or uses the image media field (like the intro image). In this case only the "url" is relevant. I search the whole Joomla for Joomla.selectedMediaFile.thumb which is never used, I assume, that is is a leftover or a typo?

So the value filled in has to be Joomla.selectedMediaFile.url to functional.

avatar dgrammatiko
dgrammatiko - comment - 29 Nov 2020

So the value filled in has to be Joomla.selectedMediaFile.url to functional.

Yes, you're right. FWIW the thumb part shouldn't be there but rather in

updatePreview() {
if (['true', 'static'].indexOf(this.preview) === -1 || this.preview === 'false' || !this.previewElement) {
return;
}
// Reset preview
if (this.preview) {
const { value } = this.inputElement;
if (!value) {
this.previewElement.innerHTML = '<span class="field-media-preview-icon"></span>';
} else {
this.previewElement.innerHTML = '';
const imgPreview = new Image();
const mediaType = {
image() {
imgPreview.src = /http/.test(value) ? value : Joomla.getOptions('system.paths').rootFull + value;
imgPreview.setAttribute('alt', '');
},
};
mediaType[this.type]();
this.previewElement.style.width = this.previewWidth;
this.previewElement.appendChild(imgPreview);
}
}
}
something like:

updatePreview() {
  if (['true', 'static'].indexOf(this.preview) === -1 || this.preview === 'false' || !this.previewElement) {
    return;
  }

  // Reset preview
  if (this.preview) {
    const { value } = this.inputElement;

    if (!value) {
      this.previewElement.innerHTML = '<span class="field-media-preview-icon"></span>';
    } else {
      let thumb = Joomla.selectedMediaFile.url;
      this.previewElement.innerHTML = '';
      const imgPreview = new Image();

      if (Joomla.selectedMediaFile.thumb) {
        thumb = Joomla.selectedMediaFile.thumb;
      }

      const mediaType = {
        image() {
          imgPreview.src = /http/.test(thumb) ? thumb : Joomla.getOptions('system.paths').rootFull + thumb;
          imgPreview.setAttribute('alt', '');
        },
      };

      mediaType[this.type]();

      this.previewElement.style.width = this.previewWidth;
      this.previewElement.appendChild(imgPreview);
    }
  }
}
avatar brianteeman
brianteeman - comment - 2 Apr 2021

Is this on hold or should it still be tested?

avatar sandramay0905
sandramay0905 - comment - 9 Jun 2021

Can a maintainer please set the label "Conflicting Files"?

avatar dgrammatiko
dgrammatiko - comment - 3 Feb 2022

This should be already fixed by now

avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar rdeutz
rdeutz - comment - 21 Oct 2022

What should we do with this PR @bembelimen @dgrammatiko

avatar dgrammatiko
dgrammatiko - comment - 21 Oct 2022

If #38805 is merged then also local adapters would have a thumb so this PR would break the other one.

avatar bembelimen bembelimen - change - 21 Oct 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-10-21 14:09:26
Closed_By bembelimen
Labels Added: Conflicting Files ? NPM Resource Changed ? Maintainers Checked
avatar bembelimen bembelimen - close - 21 Oct 2022

Add a Comment

Login with GitHub to post a comment