<% $maxw = $_GET["maxw"]; $maxh = $_GET["maxh"]; $w = $_GET["w"]; $h = $_GET["h"]; $q = $_GET["q"]; $id = $_GET["id"]; $is_image=true; $need_user_type=0; $max_width=1440; $max_height=900; $is_image=true; if ($maxw) $max_width=$maxw; if ($maxh) $max_height=$maxh; include "tools/tools.php"; $doc_row=get_row(" SELECT Picture FROM services WHERE Code=".$_GET["id"]); $image=$doc_row["Picture"]; header("Content-Type: image/jpeg"); if (strlen($image)==0 || $id=="") { if (!$w) $w=$w1; if (!$h) $h=$h1; if (!$w) $w=120; if (!$h) $h=140; $dst=imagecreatetruecolor($w,$h); // $dst=imagecreatetruecolor(2,2); $gray = imagecolorallocate($dst, 255, 255, 255); imagefill($dst,1,1,$gray); if ($q) imagejpeg($dst, NULL, $q); else imagejpeg($dst); } else if (strlen($image)>0) { $src=imagecreatefromstring($image); $x=imagesx($src); $y=imagesy($src); if ($w && $h) { $dst=imagecreatetruecolor($w,$h); imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $x, $y); if ($q) imagejpeg($dst, NULL, $q); else imagejpeg($dst); } else if ($w && !$h) { if ($w>$max_width) $w=$max_width; $h=intval($w*$y/$x); if ($h>$max_height) { $h=$max_height; $w=intval($h*$x/$y); } $dst=imagecreatetruecolor($w,$h); imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $x, $y); if ($q) imagejpeg($dst, NULL, $q); else imagejpeg($dst); } else if (!$w && $h) { if ($h>$max_height) $h=$max_height; $w=intval($h*$x/$y); if ($w>$max_width) { $w=$max_width; $h=intval($w*$y/$x); } $dst=imagecreatetruecolor($w,$h); imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $x, $y); if ($q) imagejpeg($dst, NULL, $q); else imagejpeg($dst); } else if (!$w && !$h) { $w=$x; $h=$y; if ($w>$max_width) $w=$max_width; $h=intval($w*$y/$x); if ($h>$max_height) { $h=$max_height; $w=intval($h*$x/$y); } $dst=imagecreatetruecolor($w,$h); imagecopyresampled($dst, $src, 0, 0, 0, 0, $w, $h, $x, $y); if ($q) imagejpeg($dst, NULL, $q); else imagejpeg($dst); } } %>