Add reScale and deScale components to API
This commit is contained in:
parent
e61b19b4d8
commit
ef99e30a33
|
@ -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 );
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue