Jump to content

Extension talk:StlHandler

About this board

FrViPofm (talkcontribs)

Hi, I'm trying to install StlHandler on a wiki, on my computer, so I cant send a link to a page. Sorry. The doc says that i must add the lines :

application/sla stl
text/plain stl
application/octet-stream stl

in a mime.types file. I've found no file of that name. I've found a includes/libs/mime/MimeMap.php that already contains mentions to sla and stl :

class MimeMap {
	public const MIME_EXTENSIONS = [
...
		'application/sla' => [ 'stl' ],
...
	];
...
	public const MEDIA_TYPES = [
...
		MEDIATYPE_3D => [
			'application/sla',
		],
...
	];
}

Is it something that must be added ? Where ?

I have uploaded a stl file (33kB, produced with FreeCAD) I have go a preview just after the loading. I could move it. I got the indications : 0 × 0 pixels, file size: 33 Kio, type MIME : application/sla

But when reloadding the page, or checking it on an other browser (Firefox, Chromium), I get nothing more than a grey preview. I still get the indications : 0 × 0 pixels, file size: 33 Kio, type MIME : application/sla

Some hints to explore further ?

Thanks

Ubuntu 20.04, php 7.4.24 MediaWiki 1.36.1, stlHandler 1.0 (2f0b659)

Gota de agua (talkcontribs)

@FrViPofm, I just researched this I think the most recommendable thing is to try to add to the extension the hook MimeMagicInit It is the most I can think of to make this type of extensions work that requires new types of mime.

Reply to "No display"
Daniel K. Schneider (talkcontribs)

Just a little message to tell that this extension still works fine in MW 1.31 (which is a long term release and therefore recommended for people who only upgrade every two years or so....).

Reply to "MediaWiki 1.31"

How can i use this extension

31
Gharryh (talkcontribs)

I have downloded this extension but it produces only errors Fatal error: Uncaught exception 'Exception' with message '/home/harry-arends.nl/public_html/mat54_Wiki/extensions/StlHandler/extension.json does not exist!' in /home/harry-arends.nl/public_html/mat54_Wiki/includes/registration/ExtensionRegistry.php:106 Stack trace: #0 /home/harry-arends.nl/public_html/mat54_Wiki/includes/GlobalFunctions.php(181): ExtensionRegistry->queue('/home/harry-are...') #1 /home/harry-arends.nl/public_html/mat54_Wiki/LocalSettings.php(290): wfLoadExtension('StlHandler') #2 /home/harry-arends.nl/public_html/mat54_Wiki/includes/WebStart.php(126): require_once('/home/harry-are...') #3 /home/harry-arends.nl/public_html/mat54_Wiki/index.php(38): require('/home/harry-are...') #4 {main} thrown in /home/harry-arends.nl/public_html/mat54_Wiki/includes/registration/ExtensionRegistry.php on line 106

As i am not a developer is dont know how to solve this error as by removing all StlHandler entries

HarriA (talkcontribs)

the topmost line of the error ( Fatal error: Uncaught exception 'Exception' with message '/home/harry-arends.nl/public_html/mat54_Wiki/extensions/StlHandler/extension.json does not exist!') suggests that there is no extension.json file in stlhandler folder

HarriA (talkcontribs)

After looking at how the extension is packaged in the wiki, i can see, that it's confusing - place the folder "stlHandler" in your extensions\ folder, not in extensions\stlhandler folder

Daniel K. Schneider (talkcontribs)
Daniel K. Schneider (talkcontribs)

Oh btw, big thanks for doing this project. It would allow publishing .STL files in an easy and attractive way ... under our own control.

- cheers ! Daniel :)

Gharryh (talkcontribs)
HarriA (talkcontribs)

Hi!

Thank you for your feedback!

I have fixed the issue with text-based stl files and also updated the installation instructions as some extra steps are needed. you would need to download new package to get the fix.

As for the transclusion issue - I assume you're using Chrome right? Chrome doesn't really want to cooperate sometimes, yes. However, you can still force Chrome to use WebGL, by following instructions here: http://superuser.com/questions/836832/how-can-i-enable-webgl-in-my-browser

Because I tested with Firefox, Edge and IE and the link Gharryh posted worked well on them

Daniel K. Schneider (talkcontribs)

Hi,

text files are now well accepted. Thanx :)

But the files still do not show inline. I am using Firebox (both on Windows and Linux/Ubuntu). In principle, both should be updated to the latest version. Also, it doesn't work on IE or Chrome. This is in my LocalSettings.php

# STL Handler
# https://www.mediawiki.org/wiki/Extension:StlHandler
wfLoadExtension( 'StlHandler' );
$wgFileExtensions[] = 'stl'; 
$wgTrustedMediaFormats[] = "application/sla";
$wgTrustedMediaFormats[] = "application/octet-stream";

$wgStlCanvasHeight = "480";
$wgStlCanvasWidth = "600";
$wgStlBackgroundImage  = "";
$wgStlBackgroundColor = "yellow";

An example is here: http://edutechwiki.unige.ch/en/Modular_castle_kit_-_Lego_compatible

- greetings ! Daniel

Gharryh (talkcontribs)

There are still som issues. As i have php error reporting on is produces a error ion the file:stlhandler_Body.php. I have updated to the new version. A other problem is as follows: as i move the slider on the righthand side of the screen to move the page up or down the STL object moves also. The last problem i have is more serious, when i copy the last four lines from daniel into my localsettings.php the wiki stops working. I am using firefox.

Regards

Harry

Gharryh (talkcontribs)

A small update on the slider problem: its not on chrome, nor does the error report

Daniel K. Schneider (talkcontribs)

Hi

The last ";" is missing (copy/paste mistake due to a bug in the wiki editor) from my four lines (I added/fixed the ";" now)

Also, there is indeed a php error in version 1.0 I got today (20 feb 2017).

[Mon Feb 20 18:50:25.747739 2017] [:error] [pid 1956] [client 180.76.15.155:57680] PHP Notice:  Undefined variable: longDesc in /data/portails/mediawiki/extensions/StlHandler/StlHandler_body.php on line 64

Indeed the variable seems to be missing

grep -r longDesc * 
StlHandler_body.php: $HTML .="></canvas></div><span class='fileInfo'>$longDesc</span></div>";
Gharryh (talkcontribs)
HarriA (talkcontribs)

Hi!

I have now fixed the issues you mentioned - removed the longdesc variable since the long description is used on imagepages just below the image ("Size of this preview:[...] Other Resolutions" etc) and i am not quite sure currently what and if any metadata does stl have. any ideas? Triangle count?

Also fixed the issue with the latest update that started displaying the canvas on all file pages.

As for the ongoing WebGL problem, there's really only so much I can do. If you consult the webpage I posted earlier, it lists the guide to force-enable webGL on all browsers, not just Chrome. Still, I think, a fallback message could be added if the display fails. The viewer should say something along the lines of "Please enable WebGL in your browser".

HarriA (talkcontribs)
HarriA (talkcontribs)

The newest update contains also a message if webgl is not supported or enabled

Gharryh (talkcontribs)

Just installed the update and it looks better. I have error reporting enabled by i9nserting: error_reporting( -1 );

ini_set( 'display_errors', 1 );

after the first line (<?php )

Using FireFox the slider acting on the image problem is still there, wiht Chrome no problem

Gharryh (talkcontribs)

[Whilest testing the upload function, uploading a ASCII STL file i get the following error on the upload page Uploadwaarschuwing De bestandsextensie ".stl" hoort niet bij het MIME-type van het bestand (text/plain). Uploading the same file as binairy no error is reported. This is the link to the binairy file : http://www.mat54-wiki.nl/mat54_Wiki/index.php/Bestand:Test-box.stl The ASCII file can be found here https://www.dropbox.com/sh/f0ct8fjwwpqfd3n/AAAwtrpSd4SwlD09raSoQCQva?dl=0

]

Harry

update this problem is solved, typo in mime.types file

But it still produces a error at this code-section:

[code]

    public static function onImageOpenShowImageInlineBefore( $imagepage, $out ){

            $full_url = $imagepage->getDisplayedFile()->getFullURL();

            $out->addHtml(StlHandler::generateHTMLByConfiguration());

            $out->addHtml(ResourceLoader::makeInlineScript("mw.loader.using( 'ext.StlHandler',

                                    function(){

                                        initScene('$full_url');

                                    });"

            ) );

[/code]

HarriA (talkcontribs)

Hi!

Could you give me the error please as i cant seem to reproduce this at the moment although i have the error reporting on also in my test

HarriA (talkcontribs)

Also, please explain slider acting on the image problem. If you move the scrollbar(slider) on the right down, the model zooms out? but if you use scrollwheel on mouse to scroll down, the model doesn't zoom out? In my firefox it is fine (FF 51.0.1)

Gharryh (talkcontribs)

Goodmorning,

Moving the slider rotates the model, using the scrolwheel, on the image zoom's the image. Using the slider rotates the image

The error reported is like: static method StlHandler GenerateHTMLByConfiguration() should not be called staticly in the mentioned function

Gharryh (talkcontribs)

See this litle video

Gharryh (talkcontribs)

During testing today on a tablet (ASUS) i can see the error's better. It says at first:

Strict Standards: Non-static method StlHandler::generateHTMLByConfiguration() should not be called staticaly in /extensions/StlHandler/StlHandler_body.php on line 33

the second error is:

Notice: Undefined Variable: LongDecs in /extensions/StlHandler/StlHandler_body.php on line 33 on line 64

I hope this helps

Harry

HarriA (talkcontribs)

Hi!

Thanks for the update. The rotation issue is fixed in developmental version of the extension, but has not been synced to stable versions. This also has the fix for the longdesc error Jst download new version of the handler and select master(latest developmental version) when choosing the version

Gharryh (talkcontribs)

I just updated to the latest version, but i am sorry to say that the two errors

Strict Standards: Non-static method StlHandler::generateHTMLByConfiguration() should not be called staticaly in /extensions/StlHandler/StlHandler_body.php on line 33

the second error is:

Notice: Undefined Variable: LongDecs in /extensions/StlHandler/StlHandler_body.php on line 33 on line 64

are still there

Gharryh (talkcontribs)
HarriA (talkcontribs)

Hi!

Sorry I've been off the grid for a few weeks. I have resolved the non-static method issue. Also, the background area should show only on stl files. Once again, this is currently in the master branch

Daniel K. Schneider (talkcontribs)

Hi HarriA. Thanx again ! I can confirm that the background problem is now solved. Also, the error.log file doesn't show any Php notice anymore.

MW 1.27, StlHandler 1.0 (5410f68)

Example: https://edutechwiki.unige.ch/en/File:Tower.stl

Gharryh (talkcontribs)

Perfect, so I only need to know how to show a file inside a article

HarriA (talkcontribs)

I dont plan on enabling the viewer inside an article. The reason for this is that it could potentially be a heavy hit to the load speed of an article since stl files could be quite large in size.

70.167.197.66 (talkcontribs)

What code do I need to insert into MediaWiki in order to publish 3D Model on a page?

HarriA (talkcontribs)

Hi! You click on the "Download" word in the "Installation" section of the article. Then you choose your version of Mediawiki (most likely 1.28) and follow the instructions in the "installation" section. (except, you put the "stlHandler" folder you get from the download, to the extensions/ folder not extensions/stlHandler folder)

Reply to "How can i use this extension"
TheDJ (talkcontribs)

You should consider submitting a patch to add that mime information to mediawiki core. I don't think there would be any objections to including that information.

Reply to "mime types"
There are no older topics