Re: PAGE TURNED BECOME SOURCE CODE VIEW..
| From: | BBC | Date: | Fri, 14 Jul 2006 08:34:09 +0000 |
| Subject: | Re: PAGE TURNED BECOME SOURCE CODE VIEW.. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239460@lists.php.net to get a copy of this message | ||
> On 7/9/06, BBC <bbc_danang@telkom.net> wrote:
> > I don't know why every time the script run the syntax which uses GD, the page turned
> > becomes source code view. So when we need that page in normal view, we had
> > to push the 'back button' twice.
>
> I guess we would need to see some code samples to get things going,
> preferrably the GD part which seems to be the issue :-)
Here are the Codes I used :
$tumbsize = 150;
$imgfile = $some_where;
$imgdst = $where_to;
header('Content-type: image/jpeg');
list($width,$height) = getimagesize($imgfile);
$imgratio = $width/$height;
if($imgratio>1)
{
$newwidth = $tumbsize;
$newheight = (int)($tumbsize / $imgratio);
}else{
$newheight = $tumbsize;
$newwidth = (int)($tumbsize * $imgratio);
}
$tumb = ImageCreateTrueColor($newwidth,$newheight);
$source = ImageCreateFromJpeg($imgfile);
$hai = ImageCopyResized($tumb,$source,0,0,0,0,$newwidth,$newheight,$width,$height);
ImageJpeg($tumb,$imgdst,100);
if ($hai)
{
echo "Resizing is successful<br> ";
}else{
copy($some_where,$where_to);
}
And thank for your input..