Did everything, installed the gd but still image doesnt appear. Can you spot a mistake on my code?
That'a a part of my upload script
Code: Select all
// Check for an image (not required).
if (is_uploaded_file ($_FILESї'image']ї'tmp_name'])) {
if (move_uploaded_file($_FILESї'image']ї'tmp_name'], "C:\Program Files/Apache Group/Apache/htdocs/fyp/imageuploads/{$_FILESї'image']ї'name']}")) { // Move the file over.
echo '<p>The image has been uploaded!</p>';
} else { // Couldn't move the file over.
echo '<p><font color="red">The file could not be moved.</font></p>';
$m = '';
}
$m = $_FILESї'image']ї'name'];
} else {
$m = '';
}
thats your script with slightly changed variables
Code: Select all
їphp:1:cf1ee0597c]
define(MAX_WIDTH, 100);
define(MAX_HEIGHT, 100);
$m = $_GETї'm'];
$t_width = 50;
$t_height = 50;
if(stristr($pic,".jpg"))
{
header("Content-type: image/jpeg");
$img = imagecreatefromjpeg($m);
$width = imagesx($img);
$height = imagesy($img);
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
if ($scale < 1)
{
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
$tmp_img = imagecreatetruecolor($new_width, $new_height);
imagecopyresized($tmp_img, $img, 0, 0, 0, 0,
$new_width, $new_height, $width, $height);
imagedestroy($img);
$img = $tmp_img;
imagejpeg($img);
}
else
{
imagejpeg($img);
imagedestroy($img);
}
}
else
{
$im = imagecreate(100,100);
$blue = imagecolorallocate($im,0,0,200);
$red = imagecolorallocate($im,255,0,0);
imagestring($im,2,2,5,"ERROR",$red);
imagejpeg($im);
imagedestroy($im);
}
?>
ї/php:1:cf1ee0597c]
and this is part of the script that is supposed to display the image on a table...
Code: Select all
<td align="center"><img src="resize_image.php?m=../fyp/imageuploads/{$rowї'image_name']}" alt="{$rowї'image_name']}" /></td>