Problemas com upload de imagens
Bom dia Galera
estou com um grande problema no envio de minhas imagens, os seguintes erros estão aparecendo...
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in /home/editorac/public_html/completanovo/sis/funcao_upload.php on line 112
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/editorac/public_html/completanovo/sis/funcao_upload.php on line 119
Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/editorac/public_html/completanovo/sis/funcao_upload.php on line 120
já tentei de tudo, já fiz de tudo, permissoes, php.ini, tudo o que pode imaginar e nada faz isso mudar, entrei em contato com a hospedagem e eles dizem que a biblioteca gd está ativa...
o que pode ser???
função_upload.php
function verifica_image($img)
{
// Verifica se o mime-type do arquivo é de imagem
if(eregi("^image\/(pjpeg|jpeg|png|gif|bmp)$", $img["type"]))
{
return (TRUE);
}
return (FALSE);
}// fim verifica_image
function verifica_extensao_image($img)
{
// Pega extensão do arquivo
preg_match("/\.(gif|bmp|png|jpg|jpeg){1}$/i", $img["name"], $ext);
return ($ext[1]);
}//fim verifica_extensao_imag
function verifica_dimensao_image($img, $max_x, $max_y)
{
$dimensaoImage = getimagesize($img["tmp_name"]);
$dimensao = '';
// Verifica largura
if($dimensaoImage[0] > $dimensaoImage[1])
{
if($dimensaoImage[0] > $max_x)
{
$dimensao = 'largura';
}
}
else
{
if($dimensaoImage[0] < $dimensaoImage[1])
{
if($dimensaoImage[1] > $max_x)
{
$dimensao = 'altura';
}
}
else
{
if($dimensaoImage[0] == $dimensaoImage[1])
{
if($dimensaoImage[0] > $max_x)
{
$dimensao = 'largura';
}
}
}
}
return ($dimensao);
}//fim verifica_dimensao_image
// Código tirado de http://phpweb.hostnet.com.br/manual/it/function.imagecreatefromgif.php
function gif2jpeg($p_fl, $p_new_fl='', $bgcolor=false, $imgge , $x, $y, $xx, $yy)
{
//list($wd, $ht, $tp, $at)=getimagesize($p_fl);
$img_src=imagecreatefromgif($p_fl);
//$img_dst=imagecreatetruecolor($wd,$ht);
$clr['red']=255;
$clr['green']=255;
$clr['blue']=255;
if(is_array($bgcolor))
{
$clr=$bgcolor;
}
$kek=imagecolorallocate($imgge, $clr['red'], $clr['green'], $clr['blue']);
imagefill($imgge,0,0,$kek);
imagecopyresampled($imgge, $img_src, 0, 0, 0, 0, $x, $y, $xx, $yy);
$draw=true;
if(strlen($p_new_fl)>0)
{
if($hnd=fopen($p_new_fl,'w'))
{
$draw=false;
fclose($hnd);
}
}
if(true==$draw)
{
header("Content-type: image/jpeg");
$im = imagejpeg($imgge);
}
else
{
$im = imagejpeg($imgge, $p_new_fl);
}
imagedestroy($imgge);
imagedestroy($img_src);
return $im;
} // Fim gif2jpeg
function reduz_imagem($img, $max_x, $max_y, $nome_foto, $extensaoo)
{
//pega o tamanho da imagem ($original_x, $original_y)
list($width, $height) = getimagesize($img);
$original_x = $width;
$original_y = $height;
// se a largura for maior que altura
if($original_x > $original_y) {
$porcentagem = (100 * $max_x) / $original_x;
}
else {
$porcentagem = (100 * $max_y) / $original_y;
}
$tamanho_x = $original_x * ($porcentagem / 100);
$tamanho_y = $original_y * ($porcentagem / 100);
$image_p = imagecreatetruecolor($tamanho_x, $tamanho_y);
if($extensaoo == 'jpeg' || $extensaoo == 'jpg')
{
if (function_exists('imagejpeg'))
{
$image = imagecreatefromjpeg($img);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $tamanho_x, $tamanho_y, $width, $height);
return imagejpeg($image_p, $nome_foto, 100);
}
else
{
echo('<script> alert("Sem suporte para este tipo de imagem - ' . $extensaoo . ', falha no cadastro!!"); </script>');
return false;
}
}
else
{
if($extensaoo == 'png')
{
if (function_exists('imagepng'))
{
$image = imagecreatefrompng($img);
imagealphablending($image_p, false);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $tamanho_x, $tamanho_y, $width, $height);
imagesavealpha($image_p, true);
return imagejpeg($image_p, $nome_foto);
}
else
{
echo('<script> alert("Sem suporte para este tipo de imagem - ' . $extensaoo . ', falha no cadastro!!"); </script>');
return false;
}
}
else
{
if($extensaoo == 'gif')
{
if (function_exists('imagegif'))
{
$image = imagecreatefromgif($img);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $tamanho_x, $tamanho_y, $width, $height);
return imagegif($image_p, $nome_foto, 100);
}
else
{
$clr['red']=255;
$clr['green']=255;
$clr['blue']=255;
$imag = gif2jpeg($img, $nome_foto, $clr, $image_p, $tamanho_x, $tamanho_y, $width, $height);
if($imag)
{
return $imag;
}
else
{
echo('<script> alert("Sem suporte para este tipo de imagem - ' . $extensaoo . ', falha no cadastro!!"); </script>');
}
}
}
}
}
}//fim reduz_imagemDiscussão (1)
Carregando comentários...