PHP Classes

PHP Image Resizer

Recommend this page to a friend!

      Image Resizer  >  All threads  >  PHP Image Resizer  >  (Un) Subscribe thread alerts  
Subject:PHP Image Resizer
Summary:anybody knows why this resizer doesn't work?
Messages:1
Author:Alejandro Hermoso
Date:2009-02-26 00:17:13
 

  1. PHP Image Resizer   Reply   Report abuse  
Picture of Alejandro Hermoso Alejandro Hermoso - 2009-02-26 00:17:13
anybody knows why this resizer doesn't work?.. please heeellp meee with this crap:


************This from Controller:::

function rersize($newwidth,$newheight,$filename,$uploadedfile )
{
/*
echo "
newwidth: $newwidth,<br />
newheight: $newheight,<br />
filename: $filename,<br />
name_input: $name_input<br />
";

foreach($_FILES[$name_input] as $x => $y)
{
echo $x.":".$y."<br />";
}
*/
//$uploadedfile = $_FILES[$name_input]['tmp_name'];
$src = imagecreatefromjpeg($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
//$newwidth=600;
if(($newwidth>=$width)&&($newheight>=$height))
{
$newwidth = $height;
$newheight = $width;
}
elseif($newwidth>=$width)
{
$newwidth=$width;
$newwidth = $width*($newheight/$height);
}
elseif($newheight>=$height)
{
$newheight=$height;
$newheight = $height*($newwidth/$width);
}
else
{
if($height>$width)
{
$newwidth = $width*($newheight/$height);
}
else
{
$newheight = $height*($newwidth/$width);
}

}
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($tmp,$filename,100);
imagedestroy($src);
imagedestroy($tmp);
}
?>

***********this one is from the .tpl:::

<td><small>({$lang->line('market_label_file_upload_hint')})</small>
<div class="clearAfter">
<div class="floatLeft" id="userfileExt1">
<input type="file" onchange="javascript:$('#userfileExt2').show();$('#userfileremove2').show();" id="file1" name="file1" onkeyup="javascript:$('#btnList').focus();" onkeypress="javascript:$('#btnList').focus();" onkeydown="javascript:$('#btnList').focus();"/>
</div>
<div>
<a onclick="javascript:$('#userfileExt2').show();$('#userfileremove2').show();" href="javascript:void(0);">Add</a>
</div>
</div>
<div class="clearAfter">
<div id="userfileExt2" class="floatLeft" style="display:none" >
<input type="file" onchange="javascript:$('#userfileExt3').show();$('#userfileremove3').show();" id="file2" name="file2" onkeyup="javascript:$('#btnList').focus();" onkeypress="javascript:$('#btnList').focus();" onkeydown="javascript:$('#btnList').focus();"/>
</div>
<div>
<a onclick="javascript:$('#file2').val('');$('#userfileExt2').hide();$('#userfileremove2').hide();" style="display:none" href="javascript:void(0);" id="userfileremove2">Remove</a>
</div>
</div>
<div class="clearAfter">
<div id="userfileExt3" class="floatLeft" style="display: none;">
<input type="file" onchange="javascript:$('#userfileExt4').show();$('#userfileremove4').show();" id="file3" name="file3" onkeyup="javascript:$('#btnList').focus();" onkeypress="javascript:$('#btnList').focus();" onkeydown="javascript:$('#btnList').focus();"/>
</div>
<div>
<a onclick="javascript:$('#file3').val('');$('#userfileExt3').hide();$('#userfileremove3').hide();" style="display: none;" href="javascript:void(0);" id="userfileremove3">Remove</a>
</div>
</div>
<div class="clearAfter">
<div id="userfileExt4" class="floatLeft" style="display: none;">
<input type="file" onchange="javascript:$('#userfileExt5').show();$('#userfileremove5').show();" id="file4" name="file4" onkeyup="javascript:$('#btnList').focus();" onkeypress="javascript:$('#btnList').focus();" onkeydown="javascript:$('#btnList').focus();"/>
</div>
<div>
<a onclick="javascript:$('#file4').val('');$('#userfileExt4').hide();$('#userfileremove4').hide();" style="display: none;" href="javascript:void(0);" id="userfileremove4">Remove</a>
</div>
</div>
<div class="clearAfter">
<div id="userfileExt5" class="floatLeft" style="display: none;">
<input type="file" id="userfile5" name="userfile5" onkeyup="javascript:$('#btnList').focus();" onkeypress="javascript:$('#btnList').focus();" onkeydown="javascript:$('#btnList').focus();"/>
</div>
<div>
<a onclick="javascript:$('#file5').val('');$('#userfileExt5').hide();$('#userfileremove5').hide();" style="display: none;" href="javascript:void(0);" id="userfileremove5">Remove</a>
</div>
</div>



</td>

******************please i need some help****************