UploadComponent is a simple component developed to support uploading any kind of file through CakePHP. It gives you total control of uploaded files and special functions to deal with image upload
--
if($this->request->is('post')){
$able = $this->Upload->able($this->request->data['foto'], true);
if($able === true){
$foto = uniqid(time());
$img1 = $this->Upload->uploadIMG($this->request->data['foto'],
array(
"quality" => "H",
"resize"=>array(
"width" => 140,
"height" => 140,
"cover" => 'cover'
),
"name" => $foto."_140"
));
if($img1 !== true) $this->Session->setFlush('Algo de errado aconteceu : '.$img1 );
}else{
$this->Session->setFlush('Erro : '.$able);
}
}
--
--
Direitorio a ser salvo
--
Muda o direito atual a ser salvo
--
Retorna o verdadeiro Array do arquivo
--
Seta o arquivo atual
--
Limpa as variaveis e remove o arquivo sendo usado
--
- $name Nome do arquivo
- $dir Direito do arquivo
Deleta um arquivo no diretorio atual
--
Retorna o tipo do arquivo
--
- Array* $params*
- Array Resize
- Integer width
- Integer height
- String cover
- String Name
- String Quality
- Array Resize
--
- $file Arquivo a ser verificado
- $msg Retornar uma messagem ou Boolean
- $ext Array com tipos de aquivo aceitos
--
- $w Largura da imagem
- $h Altura da image
- $x Nova Largura
- $y Nova Altura
- $cover Cortar a imagem
Retorna um array com novo W, H, X, Y