Difference between revisions of "Tutorial: PhpRunner 9.8 and Photo Display"

From dftwiki3
Jump to: navigation, search
Line 65: Line 65:
  
  
 +
=Misc.=
 +
==How to send message to /var/log/apache2/error.log==
 +
<br />
 +
::<source lang="php">
 +
// in php script:
 +
file_put_contents('php://stderr', print_r( $dico, TRUE));
 +
</source>
 +
<br />
 +
The TRUE value in print_r makes print_r return the string it displays rather than displaying it.
 +
<br />
 +
==How to get width and height of uploaded image==
 +
<br />
 +
::<source lang="php">
 +
$fileInfozzz = $values["fileName"];
 +
$dicozzz = explode( ",", $fileInfozzz );
 +
$fileNamezzz = str_replace( "[{", "", $dicozzz[0] );
 +
$fileNamezzz = str_replace( "\"", "", explode( ":", $fileNamezzz )[1] );
 +
$fileNamezzz = str_replace( "\\", "", $fileNamezzz );
 +
$filePathzzz = $_SERVER["DOCUMENT_ROOT"]. "/photos/" . $fileNamezzz;
 +
$paramszzz = getimagesize( $filePathzzz );
 +
$widthzzz = $paramszzz[0];
 +
$heightzzz = $paramszzz[1];
 +
 +
//file_put_contents('php://stderr', print_r( "\nBefore Record Added\ndico=", TRUE ) );
 +
//file_put_contents('php://stderr', print_r( $dico, TRUE));
 +
//file_put_contents('php://stderr', print_r( "\nfilePath=", TRUE ) );
 +
//file_put_contents('php://stderr', print_r( $filePathzzz, TRUE));
 +
//file_put_contents('php://stderr', print_r( "\nparams=", TRUE ) );
 +
//file_put_contents('php://stderr', print_r( $paramszzz, TRUE ));
 +
 +
file_put_contents('php://stderr', print_r( "\nwidth = ", TRUE ));
 +
file_put_contents('php://stderr', print_r( $widthzzz, TRUE ));
 +
file_put_contents('php://stderr', print_r( "\nheight = ", TRUE ));
 +
file_put_contents('php://stderr', print_r( $heightzzz, TRUE ));
 +
  
 +
// pass width and height to javascript (not sure this works...)
 +
//$pageObject->setProxyValue("widthzzz", $widthzzz);
 +
//$pageObject->setProxyValue("heightzzz",$heightzzz);
  
 +
</source>
  
  

Revision as of 13:55, 26 May 2018

D. Thiebaut (talk) 10:38, 25 May 2018 (EDT)



...