Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/09/2007, 16:55
Avatar de El_Metallick
El_Metallick
 
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 21 años, 5 meses
Puntos: 16
Problemas al hacer thumbnail

Hola maestros, les cuento, estoy tratando de redimencionar algunas imágenes de mi sitio para agilizar la carga, el tema es que estoy trabajando en modo local por ahora con windows y el appserver 2.5.8 y comentando con un amigo mi problema me dice que puede ser algún bug de la versión de php o algo así pero no me convence del todo así que les pregunto, verán tengo este formulario:

Código PHP:
<?php
    
include('includes/functions.inc.php');
    
    
$stat $_GET['stat'];
    
$name $_FILES['file']['name'];
    
$dir "http://www.forosdelweb.com/images/gallery/";
    
$extention explode(".",$name);
    
$num count($extention) - 1;
    
    
$name_thum 'thumbnail_'.$name;
    
$dir_thum "http://www.forosdelweb.com/images/gallery/thumbnail/";
    
    if(
$name == "")
    {
        if(
stat == 1)
        {
?>
<p align="center">Error</p>
<?php
        
}
?>
<form action="b.php" method="post" enctype="multipart/form-data">
  <input name="file" type="file" size="51" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight: bold; border:0px solid;" /></td>
  <p align="center"><input type="submit" name="submit" value="Subir" /></p>
</form>
<?php    
    
}
    else
    {
        if(
$extention[$num] == "jpg")
        {
            if(@
move_uploaded_file($_FILES['file']['tmp_name'], $dir.$name))
            {
                
resize($dir.$name,$dir_thum.$name_thum,200,100,95);
?>
<br /><br /><img src="<?= $dir_thum.'thumbnail_'.$name ?>" />
<?php
            
}
            else
            {
                
header("Location: b.php?stat=1");
            }
        }
    }
?>
y esta es parte del archivo functions.inc.php

Código PHP:
...
function 
resize($img,$new_img,$new_width,$new_height,$quality)

    
$ext explode(".",$img);
    
$num count($ext) - 1;

    if((
$ext[$num] == "jpg") || ($ext[$num] == "jpeg"))
    {
        
$image ImageCreateFromJPEG($img);    
    }
    else if(
$ext[$num] == "gif")
    {
        
$image ImageCreateFromGIF($img);
    }
    else if(
$ext[$num] == "png")
    {
        
$image ImageCreateFromPNG($img);
    }
    else
    {
        echo 
"Error, extencion no permitida";
        die();
    } 
    
    
$thumbnail imagecreatetruecolor($new_width,$new_height); 

    
ImageCopyResized($thumbnail,$img,0,0,0,0,$new_width,$new_height,ImageSX($img),ImageSY($img)); 

    
ImageJPEG($thumbnail,$new_img,$quality);
    
ImageDestroy($imgage);

la cosa es que al ejecutar todo esto me sube la imagen pero al tratar de redimencionarla me sale este error

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 797 bytes) in C:\AppServ\www\ceii\includes\functions.inc.php on line 290

la linea 290 es

$image = ImageCreateFromJPEG($img);

en el archivo functions.inc.php, el tema es que no tengo ni la menor idea de lo que puede estar pasando, les agradeceria cualquier comentario u opinión

Saludos y gracias de antemano
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!