Posts: 1,873
Threads: 84
Joined: Jul 2011
RE: Differnt behaviour between command line and call from php application
2023-03-13, 1:12
(2023-03-11, 8:43)Hans Willison Wrote: Hi,
When I create a snapshot from the command line, like so:
Code:
C:\>LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"
then LDView uses all the settings and preferences which I defined previously via the GUI.
When I use the same command from within a php application like so:
PHP Code:
<?php
system('LDView64.exe "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"');
then LDView obviously uses default paramters. What could be a reason for this behaviour. Maybe an issue with environment variables?
Hans
PS: I tried some additional command line preferences to overcome the issue:
PHP Code:
<?php
system('LDView64.exe -SaveZoomToFit=1 -SaveAlpha=1 -AutoCrop=1 -EdgeThickness=5 "temp_3001-4.ldr" -SaveSnapshot="3001-4.png"');
but not every setting can be controlled via Command line preferences (Edge Lines on, FieldOfView=0.1, Texture Studs off). Or did I miss something?
Almost certainly the process (I assume a web server) running PHP is running under a different user account, and therefore has a different registry. LDView's settings are (by design) user-specific. If you find out what user account PHP is running under, and you are allowed to log into that account, you can in theory export LDView's registry settings from HKEY_CURRENT_USER/Software/Travis Cobbs/LDView, and then import the settings into the other account. That may not be possible or convenient, though.
I believe that all the settings in the UI are controllable from the command line. LDView's help.html has a list of all of them. Most of them that include a UI for setting them list the title of the UI element in LDView's preferences. For example, if you search the help file for "texture studs", one of the hits is for the TextureStuds command line option. A search for "edge lines" will (eventually) lead you to the ConditionalHighlights command line option. A search for "field of view" will bring you to the FOV command line option.