Offload all model generation to model output
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace MediaWiki\Extension\GlModelViewer;
|
||||
|
||||
use ImageHandler;
|
||||
use Html;
|
||||
|
||||
class GlModelHandler extends ImageHandler {
|
||||
/**
|
||||
@@ -35,16 +36,25 @@ class GlModelHandler extends ImageHandler {
|
||||
* @return MediaTransformOutput
|
||||
*/
|
||||
public function doTransform($image, $dstPath, $dstUrl, $params, $flags = 0) {
|
||||
echo '<script>';
|
||||
self::console_log($image);
|
||||
self::console_log($dstPath);
|
||||
self::console_log($dstUrl);
|
||||
self::console_log($params);
|
||||
self::console_log($flags);
|
||||
echo '</script>';
|
||||
return new GlModelTransformOutput($image, $params);
|
||||
}
|
||||
|
||||
return new GlModelTransformOutput($image, ['type' => 'glb']);
|
||||
}
|
||||
/**
|
||||
* Check the incoming media parameters
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function validateParam( $name, $value ) {
|
||||
if (in_array($name, ['width', 'height'])) {
|
||||
return $value > 0;
|
||||
} else if (in_array($name, ['view', 'hsset'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Small helper function to display information on the browser console
|
||||
|
||||
Reference in New Issue
Block a user