-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix image selection in media field #31523
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
Conversation
|
Is |
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 So the value filled in has to be |
Yes, you're right. FWIW the thumb part shouldn't be there but rather in joomla-cms/build/media_source/system/js/fields/joomla-field-media.w-c.es6.js Lines 159 to 187 in acb3b6d
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);
}
}
} |
|
Is this on hold or should it still be tested? |
|
Can a maintainer please set the label "Conflicting Files"? |
|
This should be already fixed by now |
|
This pull request has automatically rebased to 4.2-dev. |
|
What should we do with this PR @bembelimen @dgrammatiko |
|
If #38805 is merged then also local adapters would have a thumb so this PR would break the other one. |
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
Expected result AFTER applying this Pull Request
@dgrammatiko perhaps you can check?