Olá pessoal.
Procurei no forum e não web e ainda não encontrei o que estou precisando muito, Redimensionar imagem mais ter 2 variaves pra definir largura e altura definidas por mim, todos os script que encontrei redimensionam a imagem proporcionalmente.
Algum script? alguma função? help
Upload De Imagens Com Redimensionamento De Tamanho Especifico
Started By Bobrinha, 04/09/2012, 01:51
6 replies to this topic
#1
Posted 04/09/2012, 01:51
#2
Posted 04/09/2012, 14:21
- Bobrinha likes this
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
#3
Posted 04/09/2012, 23:42
Muito obrigado amigo eu consegui aqui fazer o upload com tamanhos específicos, mais ainda to com um probleminha...
Qual a variável ou jeito de fazer mostrar o nome da imagem depois de renomeada? pois preciso jogar no DB o nome da imagem.
Agradeço desde de já
Qual a variável ou jeito de fazer mostrar o nome da imagem depois de renomeada? pois preciso jogar no DB o nome da imagem.
Agradeço desde de já
#4
Posted 05/09/2012, 12:34
Não sei como vc esta fazendo!
Abraços
Abraços
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
#5
Posted 05/09/2012, 20:34
Como vc faz para ver o nome da imagem que foi gerada no novo tamanho?
#6
Posted 06/09/2012, 17:52
Como eu vou saber ? Não vi o codigo, nem tenho ideia do que esta usando ou fazendo... fica impossivel sem bola de cristal, ehehhe 
Posta o codigo
Abraços
Posta o codigo
Abraços
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .
#7
Posted 11/09/2012, 14:09
eu criei esta classe pra isso
para usar basta fazer isso
<?php
/**
* @author squall
* @copyright 2009
*/
class Thumbs
{
//variaveis necessárias para gerar thumbs
public $caminho;
public $nome ;
public $largura_max;
public $altura_max;
public $arquivo;
public $ext;
public $tipo ;
public $ImagemGerada;
public function Thumbs()
{
// definindo valores padrão de variaveis
$this->tipo = 1;
$this->nome = date('YmdHis');
$this->altura_max = 80;
$this->largura_max = 250;
}
//preparando imagem
public function Prepare()
{
// verifica imagem se existe
if(file_exists($this->arquivo))
{
// gerando nome da nova imagem
$this->NomeImagem();
if($this->arquivo != $this->ImagemGerada)
{
$img_tamanho = @getimagesize($this->ImagemGerada);
if(!file_exists($this->ImagemGerada) || $img_tamanho[0] > $this->largura_max || $img_tamanho[1] > $this->altura_max)
{
// pegando extensão da imagem
$this->ext = substr($this->arquivo,-3);
// verificando se o caminho e existente/ se não cria diretório
$this->CriarDir();
// gerando imagem
$this->Gerar();
return $this->ImagemGerada;
}
else
return $this->ImagemGerada; // retorno da imagem existente
}
else
{
// pegando tamanho da imagem
$img_tamanho = @getimagesize($this->arquivo);
if(!file_exists($this->ImagemGerada) || $img_tamanho[0] > $this->largura_max || $img_tamanho[1] > $this->altura_max)
{
// pegando extensão da imagem
$this->ext = substr($this->arquivo,-3);
// verificando se o caminho e existente/ se não cria diretório
$this->CriarDir();
// gerando imagem
$this->Gerar();
return $this->ImagemGerada;
}
else
return $this->ImagemGerada; // retorno da imagem existente
}
}
else
return false; //retorna false se o arquivo nao for encontrado
}
// Gerador de Thumbs
public function Gerar()
{
// se extesão for jpg
if($this->ext == "jpg")
{
$imagem_orig = @imagecreatefromjpeg($this->arquivo);
}
elseif($this->ext=="png")
{
$imagem_orig = @ImageCreateFromPNG($this->arquivo);
}
elseif($this->ext=="gif")
{
$imagem_orig = @ImageCreateFromGIF($this->arquivo);
}
// pegando tamanhos da imagem
$largura_original = @ImagesX($imagem_orig);
$altura_original = @ImagesY($imagem_orig);
$altura = $altura_original;
$largura = $largura_original;
if( $largura > $this->largura_max)
{
$largura = $this->largura_max;
$altura = $altura * ($largura / $largura_original);
}
if($altura > $this->altura_max)
{
$largura = $largura * ($this->altura_max/$altura);
$altura = $this->altura_max;
}
//gerando imagem final
$imagem_final=@ImageCreateTrueColor($largura,$altura);
@ImageCopyResampled($imagem_final,$imagem_orig, 0, 0, 0, 0,$largura,$altura,$largura_original,$altura_original);
$imagem_ext=@substr($this->arquivo,-3);
// gerando arquivo
if(strtolower($this->ext=="jpg"))
@imagejpeg($imagem_final,$this->ImagemGerada,80);
if(strtolower($this->ext == "png"))
@imagepng($imagem_final,$this->ImagemGerada);
if(strtolower($this->ext == "gif"))
@imagegif($imagem_final,$this->ImagemGerada);
// destruindo informações desnecessárias
@imageDestroy($imagem_orig);
@imageDestroy($imagem_final);
//retornando caminho da nova imagem
}
public function CriarDir()
{
if(!is_dir($this->caminho))
{
mkdir($this->caminho,0777);
}
}
public function NomeImagem()
{
//pegando nome original da imagem
$imagemLimpando = @explode("/",$this->arquivo);
$imagemNome = $imagemLimpando[(count($imagemLimpando) - 1)];
// se o tipo for igual a 1 ele usa o nome original da imagem
// se não ele usa o timestamp para gerar um nome unico
if($this->tipo == 1) $imagem_gerada=$this->caminho . $imagemNome;
else $imagem_gerada = $this->caminho . $this->nome . "." . $this->ext;
$this->ImagemGerada = $imagem_gerada;
// echo "ESTA E A IMAGEM GERARAD" . $this->ImagemGerada . "<BR>";
}
}
?>
para usar basta fazer isso
//$thumbs = new Thumbs(); //$thumbs->caminho = "imagens/logomarcas/"; //$thumbs->arquivo = $_SESSION['usuario']['configuracoes']['arquivo_logomarca']; //$imagem = $thumbs->Prepare();
<?php
$squall = new Squall();
$squall->Ajudando("você");
$resultado = $squall->solucao(); ?>
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)










