Jump to content


Photo

Thumbnail


  • Faça o login para participar
1 reply to this topic

#1 fabiano.froes

fabiano.froes

    Normal

  • Usuários
  • 87 posts
  • Sexo:Não informado

Posted 10/09/2007, 21:18

Galera, estou usando essa função para criar thumbnail ...

function thumbjpg($imagem)
$img = ImageCreateFromJPEG($imagem);
$wi=ImageSX($img);
$he=ImageSY($img);
$img_wi=250;
$img_he=$he * 250 / $wi;
$destino = "fotos/thumb.jpg";
$img_nova = ImageCreateTrueColor ($img_wi,$img_he);
ImageCopyResampled ($img_nova, $img, 0, 0, 0, 0, $img_wi, $img_he, $wi, $he);
ImageJPEG($img_nova,$destino,100);
ImageDestroy($img_nova);
ImageDestroy($img);

return 1;
}


onde file eu recebo de um formulario em outra pagina..

$imagem = $_FILES["file"]["tmp_name"];
$thumb = thumbjpg($imagem)


mas o thumb não é criado e nem da erro nenhum, a tela fica em branco...
o q posso fazer...????

obs. o php do servidor é o 5.2

se alguem puder me ajudar valew...

Edição feita por: fabiano.froes, 10/09/2007, 21:22.

Arley Fabiano Santos Fróes
fabiano@4way.com.br

#2 Paulo André

Paulo André

    Why so serious?

  • Ex-Admins
  • 5114 posts
  • Sexo:Masculino
  • Localidade:Belo Horizonte - MG
  • Interesses:O.Q.F.J.?

Posted 10/09/2007, 21:57

Não testei o código, só organizei e coloquei uma chave que estava faltando:
<?php
function thumbjpg( $imagem )
{
	$img = imagecreatefromjpeg($imagem);

	$wi = imageSX($img);
	$he = imageSY($img);

	$img_wi = 250;
	$img_he = $he * 250 / $wi;

	$destino = "fotos/thumb.jpg";
	$img_nova = imagecreatetruecolor($img_wi,$img_he);

	imagecopyresampled ($img_nova, $img, 0, 0, 0, 0, $img_wi, $img_he, $wi, $he);

	imagejpeg($img_nova,$destino,100);

	imagedestroy($img_nova);
	imagedestroy($img);

return 1;
}
?>

Teste ai.

Flws...
(y)Até mais
Paulo André G Rodrigues,
ex-administrador Fórum WMO.


www.CanalDev.com.br




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq