class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
See all posts Reply
i create an controler to insert image im my image/upload... but print error "Erro de transmissão. Favor tentar novamente. "???
my main:
'imgMod'=>array(
'class'=>'application.components.imagemManager.CImageModifier',
),
my controller:
$img = Yii::app()->imgMod->load($_POST['CadastrosPessoas']['foto_casa']);
if ($img->uploaded) { //** this error detected **
$img->image_resize = true;
$img->image_ratio_y = true;
$img->image_x = 50;
$img->file_new_name_body = md5($img->file_src_name);
$img->process(Yii::getPathOfAlias('path_uploads').'/usuarios/foto_casa/');
if ($img->processed) {
echo 'image resized';
$img->clean(); //delete original image
} else {
echo 'error : ' . $img->error;
}
}else{
echo 'Erro2:'.$img->error;
}
my view:
beginWidget('CActiveForm', array(
'id'=>'pessoas-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
'htmlOptions'=>array('enctype' => 'multipart/form-data')
)); ?>
.....