-1 |
|
<?
// Na het uploaden doe het volgende
$pict = "afbeelding.jpg";
$dest_pict = "afbeelding.jpg";
$handle = @imagecreatefromjpeg($pict);
$x=imagesx($handle);
$y=imagesy($handle);
if($x > $y){
$max = $x;
$min = $y;
}
if($x <= $y){
$max = $y;
$min = $x;
}
$size_in_pixel = '800';
$rate = $max/$size_in_pixel;
$final_x = $x/$rate;
$final_y = $y/$rate;
if($final_x > $x) {
$final_x = $x;
$final_y = $y;
}
$final_x = 800;
$final_y = 600;
$black_picture = imageCreatetruecolor($final_x,$final_y);
imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255));
imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$final_x, $final_y, $x, $y);
if(!@imagejpeg($black_picture,$dest_pict, $size_in_pixel))
imagestring($black_picture, 1, $final_x-4, $final_y-8, ".", imagecolorallocate($black_picture,0,0,0));
//The number is the quality of the result picture
imagejpeg($black_picture,'', '75');
imagedestroy($handle);
imagedestroy($black_picture);
?>
<? // Na het uploaden doe het volgende $pict = "afbeelding.jpg"; $dest_pict = "afbeelding.jpg"; $handle = @imagecreatefromjpeg($pict); $x=imagesx($handle); $y=imagesy($handle); if($x > $y){ $max = $x; $min = $y; } if($x <= $y){ $max = $y; $min = $x; } $size_in_pixel = '800'; $rate = $max/$size_in_pixel; $final_x = $x/$rate; $final_y = $y/$rate; if($final_x > $x) { $final_x = $x; $final_y = $y; } $final_x = 800; $final_y = 600; $black_picture = imageCreatetruecolor($final_x,$final_y); imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255)); imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$final_x, $final_y, $x, $y); if(!@imagejpeg($black_picture,$dest_pict, $size_in_pixel)) imagestring($black_picture, 1, $final_x-4, $final_y-8, ".", imagecolorallocate($black_picture,0,0,0)); //The number is the quality of the result picture imagejpeg($black_picture,'', '75'); imagedestroy($handle); imagedestroy($black_picture); ?>
|