Ora ti posto parte di una classe che ho fatto per il resizing:
Codice PHP:
function resizeBySide( $lenght , $proportionate = true , $side = 'long' )
{
$this->_checkProperties() ;
$this->_setName() ;
switch ( $side )
{
case 'long':
if ( $this->_srcHeight > $this->_srcWidth )
{
$this->_setParamsByHeight( $lenght , $proportionate ) ;
}
else
{
$this->_setParamsByWidth( $lenght , $proportionate ) ;
}
break;
case 'short':
if ( $this->_srcHeight < $this->_srcWidth )
{
$this->_setParamsByHeight( $lenght , $proportionate ) ;
}
else
{
$this->_setParamsByWidth( $lenght , $proportionate ) ;
}
break;
default:
if ( $this->_srcHeight > $this->_srcWidth )
{
$this->_setParamsByHeight( $lenght , $proportionate ) ;
}
else
{
$this->_setParamsByWidth( $lenght , $proportionate ) ;
}
}
}
Se esegui il ridimensionamento sai anche come settare altezza e larghezza quindi non ti posto i relativi metodi.
Cmq il principio l'hai capito no?