Closed squirrelslair closed 2 years ago
I wonder if it rejects the .obj because it sees it as MIME type text: Jig.obj (file size: 212 KB, MIME type: text/plain) In the code it looks like it should be application/obj obj
Hello.
It could be a MediaWiki issue: https://www.mediawiki.org/wiki/Manual_talk:MIME_type_detection#Adding_new,_application-specific_MIME_type
I've never used 3DAlloy extension with .obj files on MediaWiki instance, I've just checked that .obj files could be loaded using extension's JavaScript code.
Could you please try to add this line:
$mime->addExtraTypes('text/plain obj');
under this one: https://github.com/dolfinus/3DAlloy/blob/a1d8b65f778e2ce49ce23ea2bfa461a6f6003750/3DAlloy_body.php#L34
and check if extension renders .obj files or not
I had started to look into this when I first posted the bug and was thinking in the same direction, but wasn't sure how to do anything about it. Thanks for posting a possible solution.
I added the line so it now look like this:
$mime->addExtraTypes('application/obj obj'); $mime->addExtraTypes('text/plain obj'); $mime->addExtraTypes('application/sla stl stlb');
Mime type is still detected as (file size: 212 KB, MIME type: text/plain).
Tried a re-import/update of the same file, and an upload of a different .obj since I don't know if the problem is "set" on import or on calling the file, same problem for all.
Well, it looks like it can work only if you manually create page with 3d tag or function with file name passed into it.
If you mean if I manually create a page that calls the .obj, then no, it still doesn't work: https://wiki.squirrelslair.ca/index.php?title=Mediawiki_Extension_3DAlloy/OBJ_file_problems
That's why I initially reported it. I just tested it against the files directly when you asked because there it actually lists the mime type. Should have been specific that it still doesn't show on the page, I guess.
The page content is:
** parser fn: {{#3d:File:Jig.obj|50|50|0xff00ff|0.8|0|25|60}}
** parser tag: <3d file="File:Jig.obj" width="50" height="50"></3d>
You should remove File:
from it:
** parser fn: {{#3d:Jig.obj|50|50|0xff00ff|0.8|0|25|60}}
** parser tag: <3d file="Jig.obj" width="50" height="50"></3d>
When I try it without the ...file:... it stops working even for .stl
I've made few changes to extension, please try v1.4.
It now should work with your .obj file, see example: https://en.crystalls.info/User:Maxim_Martinov
Thanks for the update! Downloaded newest version 1.5 (3e0dace) and OBJ files now work in parser function and parser tag. They still don't work when the obj is called as a file. See https://wiki.squirrelslair.ca/index.php?title=Mediawiki_Extension_3DAlloy/OBJ_file_problems
Your welcome!
This doesn't display .obj files. Here is a page that tries to call files via 3DAlloy: https://wiki.squirrelslair.ca/index.php?title=Mediawiki_Extension_3DAlloy/OBJ_file_problems
Are additional steps required to make .obj work?
I am testing this in 1.38 so a not-yet-life version. But even if that's the only reason for the error, it will need fixing when that version comes. MediaWiki: 1.38.0-alpha (dc25ae5) Git branch: T297455 PHP: 7.4.25 Time: 0.81527 Memory: 45.92 MB (Peak: 46 MB)