Foros del Web » Programando para Internet » PHP »

Problema al intentar subir una imagen

Estas en el tema de Problema al intentar subir una imagen en el foro de PHP en Foros del Web. Buenas Tardes soy nuevo en esto pero estoy desesperado al momento de subir una pagina me muestra este error: Fatal error: Out of memory (allocated ...
  #1 (permalink)  
Antiguo 22/02/2008, 15:14
 
Fecha de Ingreso: febrero-2008
Mensajes: 11
Antigüedad: 16 años, 2 meses
Puntos: 0
Exclamación Problema al intentar subir una imagen

Buenas Tardes soy nuevo en esto pero estoy desesperado al momento de subir una pagina me muestra este error:

Fatal error: Out of memory (allocated 26214400) (tried to allocate 11264 bytes) in /home/umiedu/public_html/CapturaNoticias/libreriagraficaphp.php on line 49

esa linea que marca el error es referente a esta funcion:

function thumbnail($image_path,$thumb_path,$image_name,$thu mb_width)
{
$src_img = imagecreatefromjpeg("$image_path/$image_name");
$origw=imagesx($src_img);
$origh=imagesy($src_img);

//Nuevo
if ( $origw <= $thumb_width && $origh <= $thumb_width )
{ //Si la foto es mas pequeña que la dimension dada, queda igual
$new_w = $origw;
$new_h = $origh;
}
else
{ //Si la Foto es mas grande, escala con el valor de la dimension dada como maximo
$k = ( $origw >= $origh ) ? $origw / $thumb_width : $origh / $thumb_width;
$new_w = $origw/$k;
$new_h = $origh/$k;
}

//Nuevo
//-->$new_w = $thumb_width;
//$diff=$origw/$new_w;
//$new_h=$new_w;
//-->$new_h=round(($new_w*$origh)/$origw);
$dst_img = imagecreatetruecolor($new_w,$new_h);

// for($i=0; $i<256; $i+=2)
// imagecolorallocate($dst_img , $i, $i, $i);

imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_ w,$new_h,imagesx($src_img),imagesy($src_img));

imagejpeg($dst_img, "$thumb_path/$image_name");
return true;
}


NOTA: lo que esta señalado en rojo es donde me marka el error si alguien me puede aclara el problema se lo agradeseria mucho

que tengan Un buen dia
  #2 (permalink)  
Antiguo 22/02/2008, 15:31
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: Problema al intentar subir una imagen

El error que te sale es que la imagen en la memoria RAM, mide mas que el máximo de memoria que PHP tiene asignado.

Debes incrementar la memoria editando el php.ini, y subiendo el limite máximo de memoria.

Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:42.