<?php
header("Content-type: image/jpeg");
$file= "image.jpg";
$path= "image";
$filepath = $path."/".$file;
if(file_exists("$filepath")) {
$h_img= imagecreatefromjpeg("$path/$file");
$width= imagesx($h_img);
$height= imagesy($h_img);
$thb_x= 100;
$thb_y= 100;
$h_thb= imagecreatetruecolor($thb_x, $thb_y);
imagecopyresized(
$h_thb,
$h_img,
0,
0,
0,
0,
$thb_x,
$thb_y,
$width,
$height
);
imagejpeg($h_thb, "$file");
imagedestroy($h_thb);
imagedestroy($h_img);
}
readfile("$file");
?>
|