IE7styles.css | archive.php | comments-popup.php | comments.php | crop.php | flere_kategorier.php | flere_nyheder.php | footer.php | frontpage.php | header.php | index.php | menu.php | page.php | posts.php | posts_content.php | right_sidebar.php | right_sidebar_single.php | single.php | single_page.php | style.css |
<?php
function crop_image($image_path, $crop_to_width, $crop_to_height)
{
$dimensions = getimagesize($image_path);
$image_width = $dimensions[0];
$image_height = $dimensions[1];
$start_offset_width = ($image_width / 2) - ($image_width / 4);
$start_offset_height = ($image_height / 2) - ($image_height / 3);
if($crop_to_width > 400)
{
$start_offset_width = ($image_width / 2) - ($image_width / 2);
$start_offset_height = ($image_height / 2) - ($image_height / 2);
}
$zoom = 1;
if(isset($_GET["p"]))
{
$zoom = $_GET["p"];
}
$image_temp = imagecreatefromjpeg($image_path);
$thumb_size_height = $crop_to_height;
$thumb_size_width = $crop_to_width;
$image_p = imagecreatetruecolor($thumb_size_width, $thumb_size_height);
imagecopyresampled($image_p,$image_temp, 0,0,$start_offset_width,$start_offset_height,
$thumb_size_width,$thumb_size_height,$thumb_size_width * $zoom,$thumb_size_height * $zoom);
header('Content-type: image/jpeg');
imagejpeg($image_p);
imagedestroy($image_p);
}
crop_image($_GET["i"], $_GET["w"], $_GET["h"]);
?>