PHP code example of filmtools / standards

1. Go to this page and download the library: Download filmtools/standards library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

filmtools / standards example snippets



use FilmTools\Standards\StandardInterface;

// Returns a name or short description of this developing standard.
public function getName() : string;

// Returns the minimum film density of interest
public function getDmin() : float;

// Returns the maximum film density of interest
public function getDmax() : float;

// Returns the file path to CSV with norm data
public function getNormDataFile() : string;


use FilmTools\Standards\StandardProviderInterface;

// Returns the Standard instance, or null.
public function getStandard() : ?StandardInterface;


use FilmTools\Standards\StandardProviderTrait;
use FilmTools\Standards\StandardProviderInterface;

class MyClass implements StandardProviderInterface {
  use StandardProviderTrait;
}

$foo = new MyClass;

print_r( $foo->standard );
print_r( $foo->getStandard() );


use FilmTools\Standards\StandardAwareInterface;

// Sets the Standard instance.
public function setStandard( StandardInterface $standard);


use FilmTools\Standards\StandardAwareTrait;
use FilmTools\Standards\StandardAwareInterface;
use FilmTools\Standards\TraditionalStandard;

class MyClass implements StandardAwareInterface {
  use StandardAwareTrait;
}

$foo = new MyClass;
$foo->setStandard( new TraditionalStandard );
print_r( $foo->standard );
print_r( $foo->getStandard() );


use FilmTools\Standards\StandardsFactory;

$standard_factory = new StandardsFactory;
$standard_factory = new StandardsFactory("iso6");

// Call without standard name
$standard = $standard_factory();

echo get_class($standard);
// FilmTools\Standards\TraditionalStandard


use FilmTools\Standards\TraditionalStandard;
use FilmTools\Standards\TraditionalInterface;

echo TraditionalInterface::DMIN; // 0.1
echo TraditionalInterface::DMAX; // 1.29

$standard = new TraditionalStandard;
$standard = $standard_factory("iso6");
$standard = $standard_factory("traditional");

echo $standard->getName(); // "Traditional (ISO6)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-iso6.csv"


use FilmTools\Standards\LambrechtWoodhouseStandard;
use FilmTools\Standards\LambrechtWoodhouseInterface;

echo LambrechtWoodhouseInterface::DMIN; // 0.17
echo LambrechtWoodhouseInterface::DMAX; // 1.37

$standard = $standard_factory("wbm");
$standard = new LambrechtWoodhouseStandard;

echo $standard->getName(); // "Way Beyond Monochrome (Lambrecht/Woodhouse)"
echo $standard->getDmin(); // 0.17
echo $standard->getDmax(); // 1.37
echo $standard->getNormDataFile // "/path/to/normdensities-wbm.csv"


use FilmTools\Standards\KodakStandard;

$standard = $standard_factory("kodak");
$standard = $standard_factory("ci");
$standard = new KodakStandard;

echo $standard->getName(); // "Contrast Index (Kodak)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-ci.csv"


use FilmTools\Standards\IlfordStandard;

$standard = $standard_factory("ilford");
$standard = $standard_factory("gbar");
$standard = new IlfordStandard;

echo $standard->getName(); // "G-bar (Ilford)"
echo $standard->getDmin(); // 0.1
echo $standard->getDmax(); // 1.29
echo $standard->getNormDataFile // "/path/to/normdensities-iso6.csv"