Add reScale and deScale components to API

This commit is contained in:
Kyle Johnson 2014-12-23 11:22:34 -05:00
parent e61b19b4d8
commit ef99e30a33
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
<?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 );
}
}
?>