Esto seria la parte del cógido que hace referencia al archivo process_member_register.php
Código PHP:
//upload picture
if ($err == '' && $_FILES['img']['tmp_name'] != '') {
$tmp = md5($en['user']);
$temp = $tmp.'.'.fileext($_FILES['img']['name']);
move_uploaded_file($_FILES['img']['tmp_name'],'images/pictures/'.$temp);
$s = getimagesize('images/pictures/'.$temp);
if ($s[0] == 0) $err .= '<Br>'._upload_valid;
if (!$err) {
$img = 'images/pictures/temp_'.$tmp.'.jpg';
create_thumbnail(pic_img_w,pic_img_h,'images/pictures/'.$temp,$img,pic_q);
}
unlink('images/pictures/'.$temp);
}
Y luego estaria este otro archivo llamado images.php
Código PHP:
<?
function ImageCopyResampleBicubic ($dst_img, $src_img, $dst_x, $dst_y,$src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {
$scaleX = ($src_w - 1) / $dst_w;
$scaleY = ($src_h - 1) / $dst_h;
$scaleX2 = $scaleX / 2.0;
$scaleY2 = $scaleY / 2.0;
for ($j = $src_y; $j < $src_y + $dst_h; $j++)
{
$sY = $j * $scaleY;
for ($i = $src_x; $i < $src_x + $dst_w; $i++)
{
$sX = $i * $scaleX;
$c1 = ImageColorsForIndex ($src_img, ImageColorAt($src_img, (int) $sX, (int) $sY + $scaleY2));
$c2 = ImageColorsForIndex ($src_img, ImageColorAt($src_img, (int) $sX, (int) $sY));
$c3 = ImageColorsForIndex ($src_img, ImageColorAt($src_img, (int) $sX + $scaleX2, (int) $sY + $scaleY2));
$c4 = ImageColorsForIndex ($src_img, ImageColorAt($src_img, (int) $sX + $scaleX2, (int) $sY));
$red = (int) (($c1['red'] + $c2['red'] + $c3['red'] + $c4['red']) / 4);
$green = (int) (($c1['green'] + $c2['green'] + $c3['green'] + $c4['green']) / 4);
$blue = (int) (($c1['blue'] + $c2['blue'] + $c3['blue'] + $c4['blue']) / 4);
$color = ImageColorClosest ($dst_img, $red, $green,$blue);
ImageSetPixel ($dst_img, $dst_x + $i - $src_x, $dst_y + $j - $src_y,$color);
}
}
}
function internal_create_thumbnail($forcedwidth, $forcedheight, $sourcefile, $destfile, $imgcomp)
{
global $en;
$ext = $en['ext'];
$g_imgcomp=100-$imgcomp;
$g_srcfile=$sourcefile;
$g_dstfile=$destfile;
$g_fw=$forcedwidth;
$g_fh=$forcedheight;
if(file_exists($g_srcfile))
{
$g_is=getimagesize($g_srcfile);
if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh))
{
$g_iw=$g_fw;
$g_ih=($g_fw/$g_is[0])*$g_is[1];
}
else
{
$g_ih=$g_fh;
$g_iw=($g_ih/$g_is[1])*$g_is[0];
}
if ($g_iw > $forcedwidth) {
$g_ih = round($g_ih / ($g_iw/$forcedwidth));
$g_iw = $forcedwidth;
}
if ($g_is[0] <= $forcedwidth && $g_is[1] <= $forcedheight) {
$g_iw = $g_is[0];
$g_ih = $g_is[1];
}
$ext = fileext($sourcefile);
switch($ext) {
case 'jpg': $img_src=@imagecreatefromjpeg($g_srcfile); break;
case 'jpeg': $img_src=@imagecreatefromjpeg($g_srcfile); break;
case 'gif': $img_src=@imagecreatefromgif($g_srcfile); break;
case 'png': $img_src=@imagecreatefrompng($g_srcfile); break;
}
if (!$img_src) {
echo 'Image resize failed';
return false;
}
$img_dst = @imageCreateTrueColor($g_iw, $g_ih);
if (!$img_dst) {
//256 colors...
$img_dst = imageCreate($g_iw, $g_ih);
ImageCopyResized($img_dst, $img_src, 0, 0,0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]);
} else {
//true color
ImageCopyResampleBicubic ($img_dst, $img_src, 0, 0,0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]);
}
imagejpeg($img_dst, $g_dstfile, $g_imgcomp);
imagedestroy($img_dst);
return true;
}
else
return false;
}
?>
A ver si ven algo que pueda estar mal y por ello me de el error al subir los archivos.
Saludos y gracias!