zoneminder/web/api/app/Controller/Component/ScalerComponent.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
646 B
PHP
Raw Normal View History

2015-06-11 10:58:58 +08:00
<?php
App::uses('Component', 'Controller');
class ScalerComponent extends Component {
public function reScale( $dimension, $dummy ) {
for ( $i = 1; $i < func_num_args(); $i++ )
{
$scale = func_get_arg( $i );
if ( !empty($scale) && $scale != 100 )
$dimension = (int)(($dimension*$scale)/100);
}
return( $dimension );
}
public function deScale( $dimension, $dummy )
{
for ( $i = 1; $i < func_num_args(); $i++ )
{
$scale = func_get_arg( $i );
if ( !empty($scale) && $scale != 100 )
$dimension = (int)(($dimension*100)/$scale);
}
return( $dimension );
}
}
?>