Sketchup accepts HTML dialog with php?

Hello Everyone. I’m trying to show all images from a directory using HTML, in my researches i found a way to do it using a PHP code inside the HTML, does sketchup accept it ?

To run PHP you’d need to include a web server somehow in the extension. It’s quit a bit easier to use Ruby to generate a file list and either use Javascript or Ruby to generate the HTML from it.

@eneroth is correct. PHP is a server-side technology that generates an HTML page by replacing codes in the source page with data from a database on the server. It might be possible to fetch pages to display from a web server that already runs PHP, but it would be quite complicated to embed PHP directly in SketchUp as there is no web server there, only a browser.

Do you wish to just list the image files ?

OR show thumbnails of the images ?

Allow selection of one of the files ?

I need to create a box in html because I am developing a plugin where I have several images in a specific directory where I can add and remove them.

These images will be displayed on this box.

When you click on the specific image, It will take the name of that image and save it on a variable.
Here is a example of what i need

Have you tried this …

image_path = File.join(ENV["USERPROFILE"],"Pictures") # change as needed

chosen_file = UI.openpanel(
  "Choose an image file ...",
  "Image Files|*.jpg;*.png;||"


I did, but i think that the panel is no suitable in this case because the user will not be allowed to navigate throught the directories, he will be allowed only to see and select the image on this specific folder

Okay then you’ll need to use HTML and JavaScript.

1 Like