config = &$CONF; } function moveUploadedImage(&$image, $destiny_path) { $error = $this->checkFileValues($image, $destiny_path); if ( ereg("^0+$", $error) ) { $error = ( copy($image['tmp_name'], $destiny_path . $image['name']) ? 0 : 1 ); } return $error; } function checkFileValues($image) { $error; if ( is_array($image) ) { $error .= 0; if ( file_exists($image['tmp_name']) ) { $error .= 0; if ( !empty($image['name']) ) { $error .= 0; $error .= ( $image['size'] > 0 ? 0 : 1 ); } else $error .= 1; } else $error .= 1; } else $error .= 1; return $error; } function adaptImage($location, $width, $height) { $imgValues = getimagesize($location); $size = $imgValues; if ( ( $imgValues[0] > $imgValues[1] ) && ( $imgValues[0] > $width ) ) { $size[0] = $width; $percent = floor( ( $size[0] * 100 ) / $imgValues[0] ); $size[1] = floor( ( $imgValues[1] * $percent ) /100 ); } elseif ( ( $imgValues[0] < $imgValues[1] ) && ( $imgValues[1] > $height ) ) { $size[1] = $height; $percent = floor( ( $size[1] * 100 ) / $imgValues[1] ); $size[0] = floor( ( $imgValues[0] * $percent ) /100 ); } $size[2] = ( $size[0] < $width ? floor( ( $width - $size[0] ) / 2 ) : '0' ); $size[3] = ( $size[1] < $height ? floor( ( $height - $size[1] ) / 2 ) : '0' ); return $size; } } ?>