@@ -92,6 +92,9 @@ export class MaterialX_GPUOpen_Client extends WebSocketClient
9292 const title = extractedData . title ;
9393 console . log ( 'Title:' , title ) ;
9494
95+ const preview_url = extractedData . url ;
96+ console . log ( 'URL:' , preview_url ) ;
97+
9598 const dataObj = extractedData . data ;
9699 const imageDOM = document . getElementById ( 'extracted_images' ) ;
97100 imageDOM . innerHTML = '' ; // Clear existing images
@@ -103,6 +106,7 @@ export class MaterialX_GPUOpen_Client extends WebSocketClient
103106 // Optionally save zip of data to file.
104107 let save_extracted = document . getElementById ( 'save_extracted' ) . checked ;
105108 let zip = save_extracted ? new JSZip ( ) : null ;
109+
106110 for ( const key in dataObj ) {
107111 if ( key . endsWith ( '.mtlx' ) ) {
108112 this . extractedEditor . setValue ( dataObj [ key ] ) ;
@@ -157,6 +161,26 @@ export class MaterialX_GPUOpen_Client extends WebSocketClient
157161 }
158162 }
159163
164+ if ( preview_url ) {
165+ // Create a container for the image and label
166+ const imageContainer = document . createElement ( 'div' ) ;
167+ imageContainer . style . display = 'inline-block' ;
168+ imageContainer . style . margin = '10px' ;
169+ imageContainer . style . textAlign = 'center' ; // Center the label under the image
170+
171+ // Create the image element
172+ const img = document . createElement ( 'img' ) ;
173+ img . src = preview_url ;
174+ img . width = 200 ;
175+ img . alt = "" ;
176+
177+ // Add the key as a tooltip
178+ img . title = "Preview render" ;
179+
180+ imageContainer . appendChild ( img ) ;
181+ imageDOM . appendChild ( imageContainer ) ;
182+ }
183+
160184 // Create the zip file asynchronously
161185 if ( zip )
162186 {
0 commit comments