rendered paste body<?php include "inc.php"; if(isset($_REQUEST["pic"]) && is_numeric($_REQUEST["pic"])) { $pic_id = $_REQUEST["pic"]; } else { redirect(); die(); } if(isset($_REQUEST["thumb"])) $thumb = true; else $thumb = false; $link = db_connect(); $pic_info = get_file_info($pic_id); // läs in bilden $image = new Imagick($pic_info["fullpath"]); $image->setImageFormat("jpeg"); if(isset($_REQUEST["thumb"])) { $img_w = $image->getImageWidth(); $img_h = $image->getImageHeight(); list($max_w, $max_h) = explode("x", $thumbsize); list($img_final_w, $img_final_h) = get_final_resolution($img_w, $img_h, $max_w, $max_h); $image->resizeImage($img_final_w, $img_final_h, Imagick::FILTER_MITCHELL, 0.66); $image->setCompression(Imagick::COMPRESSION_JPEG); $image->setCompressionQuality(88); } elseif($limit_size) { $img_w = $image->getImageWidth(); $img_h = $image->getImageHeight(); list($max_w, $max_h) = explode("x", $viewsize); list($img_final_w, $img_final_h) = get_final_resolution($img_w, $img_h, $max_w, $max_h); $image->resizeImage($img_final_w, $img_final_h, Imagick::FILTER_MITCHELL, 0.66); $image->setCompression(Imagick::COMPRESSION_JPEG); $image->setCompressionQuality(87); } // $size = $image->getImageSize(); // ger fel värde $size = strlen($image); header("Content-Type: image/jpeg"); header("Content-Length: " . $size); echo $image;?>