The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
$img_file = "sourceimage.jpg";
header("Content-type: image/jpeg");
$width = 180;
list($width_orig, $height_orig) = getimagesize($img_file);
print("$width_orig, $height_orig
");
$height = (int) (($width / $width_orig) * $height_orig);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($img_file);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, $img_file, 100);
imagedestroy($img_file);
Lifted mostly from PHP.net. Am I supposed to make this in a seperate file, then use it with HTML image tags? Had a look around the web, but couldn't find anything helpful. There's no apparent output, and my GD build is ok.
> imagejpeg($image_p, $img_file, 100);
should be....
imagejeg($image_p);
Then you'll be able to use the code in an HTML img tag, eg
$img_file = "sourceimage.jpg";
header("Content-type: image/jpeg");
$width = 180;
list($width_orig, $height_orig) = getimagesize($img_file);
print("$width_orig, $height_orig
");
$height = (int) (($width / $width_orig) * $height_orig);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($img_file);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, $img_file, 100);
imagedestroy($img_file);
Lifted mostly from PHP.net. Am I supposed to make this in a seperate file, then use it with HTML image tags? Had a look around the web, but couldn't find anything helpful. There's no apparent output, and my GD build is ok.