Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal , peguei um script para tratamento de imagens mas não funciona.Coloquei o imagem.php na mesma pasta das imagens e chamei o link abaixo.Já está desbloqueada a extenção php_gd2.dll no php.ini Já verifiquei a extenção o caminho e a dll , está tudo certo.O que será?Já fiz esse teste e deu tudo certo:
> <?if(function_exists("imagecreate")){echo "Parabéns! A GD está instalada!";}?>
imagem.php
<?php// Funçao cria imagem $img = ImageCreateFromJpeg($imagem); //recebe a altura e largura da imagem e //ja tira a proporção de largura$wi = ImageSY($img);$he = ImageSX($img);$img_wi = $altura;$img_he = $he $altura / $wi;//Aqui é criada a nova imagem$img_nova = imagecreatetruecolor ($img_he,$img_wi); imagecopyresized ($img_nova, $img, 0, 0, 0, 0, $img_he, $img_wi, $he, $wi);//Nessa parte é inserido o texto sobre a imagem e tamanho da font "5" pode//variar de 1 a 5, ja o "10,10" é a posição do texto y,x sobre a imagem e por fim 3//referente a coluna imagestring($img_nova, 5, 10, 10, $msg, 3); / Cabeçalhos de img para printar a imagem na tela */ Header("Content-disposition: filename=$imagem"); Header("Content-Type: image/jpeg"); ImageInterlace($img_nova,1); ImageJpeg($img_nova); ImageDestroy($img_nova); ImageDestroY($img); ?>
Link:
http://localhost/imagem.php?imagem=tempo.jpg&altura=200
O erro:
Warning: imagesy(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 9Warning: imagesx(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 10Warning: Division by zero in C:\PHP\web\imagem.php on line 12Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\PHP\web\imagem.php on line 16Warning: imagecopyresized(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 17Warning: imagestring(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 22Warning: Cannot modify header information - headers already sent by (output started at C:\PHP\web\imagem.php:9) in C:\PHP\web\imagem.php on line 27Warning: Cannot modify header information - headers already sent by (output started at C:\PHP\web\imagem.php:9) in C:\PHP\web\imagem.php on line 28Warning: imageinterlace(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 29Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 30Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 31Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\PHP\web\imagem.php on line 32
Carregando comentários...