I am using the following code to create an on screen image.
The code works ok but the image has a black line down the right hand side and accross the bottom.
I get this result on several machines.
Any clues what may be wrong?
Keith
The code works ok but the image has a black line down the right hand side and accross the bottom.
I get this result on several machines.
Any clues what may be wrong?
Code:
<?php
$img_name =$_GET['imnam'];
$ranum = $_GET['cod'];
//$img_name = "midad.jpg";
$max_width = 150; // maximum x aperture in pixels
$max_height = 150; // maximum y aperture in pixels
$size=GetImageSize($img_name);
$width_ratio = ($size[0] / $max_width);
$height_ratio = ($size[1] / $max_height);
if($width_ratio >=$height_ratio)
{
$ratio = $width_ratio;
}
else
{
$ratio = $height_ratio;
}
$new_width = ($size[0] / $ratio);
$new_height = ($size[1] / $ratio);
Header("Content-Type: image/jpeg");
$src_img = ImageCreateFromJPEG($img_name);
$thumb = ImageCreateTrueColor($new_width,$new_height);
ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width-1),($new_height-1),$size[0],$size[1]);
$textcolor = imagecolorallocate($thumb, 0, 0, 0);
imagestring($thumb, 4, $new_width- 65, $new_height-120, $ranum, $textcolor);
ImageJPEG($thumb);
ImageDestroy($src_img);
ImageDestroy($thumb);
?>
Keith