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");
}
}
}
?>
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);
}
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