[4.3] Media Manager support for svg images + set natural{width/height}#39586
[4.3] Media Manager support for svg images + set natural{width/height}#39586obuisard merged 23 commits intojoomla:4.3-devfrom
Conversation
|
I have tested this item ✅ successfully on ed67f35 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
administrator/components/com_media/resources/scripts/store/mutation-types.es6.js
Outdated
Show resolved
Hide resolved
…ation-types.es6.js Co-authored-by: Quy <quy@nomonkeybiz.com>
Is it a valid svg file? these are the options on my test site: {
"Allowed Extensions" : "svg,bmp,gif,jpg,jpeg,png,webp,ico,mp3,m4a,mp4a,ogg,mp4,mp4v,mpeg,mov,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv",
"Legal Image Extensions (File Types)": "svg,bmp,gif,jpg,png,jpeg,webp",
"Legal MIME Types": "image/svg+xml,image/jpeg,image/gif,image/png,image/bmp,image/webp,audio/ogg,audio/mpeg,audio/mp4,video/mp4,video/webm,video/mpeg,video/quicktime,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip"
} |
|
My settings are the same. Here is the cleaned logo using the service which I can now upload but the other issues remain. |
|
Oh, I think it's the |
|
I do remember now, but I have the same issues under |
Inspecting more carefully the reported URL is wrong, it shouldn't have the |
|
@Quy can you do something, got to the page where the console error happen, open the browser inspector and paste in the console this |
|
|
Thanks, so the values are correct... |
|
This is only happening with SVG files. |
|
This could be why width/height=0 due to not finding the image when selecting a SVG file. |
Yes, but the root is not actually in the Form Field Media, but probably in the PHP code of either the filesystem or the MediaHelper, I guess for some reason the followin conditional is wrong on your machine: https://github.com/joomla/joomla-cms/pull/39586/files#diff-b9cf1b73ab2438daa98290f2c650099e320527df061d94e31763982e9743dacdR116 Could you patch that line to: if (strtolower(pathinfo($file, PATHINFO_EXTENSION)) === 'svg' && self::isValidSvg($file, false)) { |
|
No go :( |
|
I have tested this item ✅ successfully on be07515 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
|
I have been doing some testing and I would like to know if someone got into this one: on my tests, everything works great (yeah!) on my php 8 environments. However, uploads fail and thumbnails don't show in php 7.4 in the media manager. I will retry with the full package (I just tried the PR's update package) and see if I get the same issues. Nevertheless, I wanted to mention it and see if others ran into the same problems. I don't have any errors in logs or console errors either. |
Are those svg files or any image? |
Only SVG images.
image/svg+xml is uncommented in mime.types. Note that I use the same Apache for php 7 and 8 tests. I will try in another environment (tried initially in Wampserver). |
|
@obuisard set a break point here: https://github.com/joomla/joomla-cms/pull/39586/files#diff-b9cf1b73ab2438daa98290f2c650099e320527df061d94e31763982e9743dacdR514 do you get any errors or the sanitisation completes correctly? |
It does not even get there. |
|
@obuisard then that's another issue |
Agree, just can't figure out what it is. We need someone else to test your PR. Reaching out. |
|
@obuisard can you email me you php 7.4 ini file? |
|
@obuisard fwiw the issue is not related as it's (probably) coming from which seems a invalid token or something similar... |
|
I have tested this item 🔴 unsuccessfully on be07515 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
|
@sdwjoomla can you try uploading the same svg on the 4.3-dev branch (not this pr)? |
|
@dgrammatiko Downloaded Joomla_4.3.0-alpha3-dev+pr.39586-Development-Full_Package.zip Clicking the vertical three dot menu and selecting Preview displays the image correctly. Thumbnail does not display. Tried upload a new SVG, no change to settings, received error "unable to upload file" In Cassiopeia, changed logo back to a PNG, saved, then changed back to SVG, the dimensions displayed incorrectly as 0 width and 0 height. Manually added SVG to the images folder on the server, thumbnail displays, selected the image in the media manager and clicked the 'i' icon/link, the dimensions display correctly Downloaded Joomla_4.3.0-alpha3-dev-Development-Full_Package.zip Please note there is a typo in the testing instructions, image\svg+xml, should be image/svg+xml |
|
@obuisard @sdwjoomla fwiw both 4.2 and 4.3 failed to upload svg with 7.4. Anyways, the problem is the returning mime type, with php 8+ we get @Quy sorry can we have one more retest here? Thanks |
|
Your last changes fixed everything on my test sites. Thumbs up for your PR, Dimitris @dgrammatiko and help in figuring out what was wrong on our tests. |
|
I have tested this item ✅ successfully on dfcf205 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
1 similar comment
|
I have tested this item ✅ successfully on dfcf205 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39586. |
|
Thank you Dimitris @dgrammatiko for this PR! |
|
@Quy @obuisard @sdwjoomla thanks for the tests @SniperSister @HLeithner please consider using a composer package for the mime types |





Pull Request for Issue #39571, #39538, #39543 . Complimentary to #39574 Previous attempt: #38722
Summary of Changes
In pictures
Testing Instructions
svgto the image extensions, allowed extensions andimage/svg+xmlto the allowed mime typesActual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
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:
No documentation changes for manual.joomla.org needed